home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / iffmasterpro / asm1_iffmasterpro.s < prev    next >
Text File  |  1980-01-06  |  123KB  |  7,222 lines

  1. ;
  2. ; IFFMaster Pro v0.99n - Release 2
  3. ;
  4. ; The Original Release 1 had corrupted source, this version is now 100%
  5. ; (This version now assembles correctly with ASM-One v1.25)
  6. ;
  7. ; ©1994 REbEL
  8. ;
  9. ; This program and its source may be freely distributed but the copyright
  10. ; remains at all times with myself. The code may not be altered in any
  11. ; manner, and no person may claim responsibility for writing this program.
  12. ; This source is provided purely as an insight into IFF ILBM handling and
  13. ; system coding in assembler.
  14. ;
  15. ; An IFF to RAW converter which is based upon IFFMASTER but with the
  16. ; inclusion of AGA compatibility.
  17. ;
  18. ; Requires my system.gs file (included in this archive) and system
  19. ; includes revision 3.1 (v40).
  20. ;
  21. ;
  22. ; OPTIMAL TAB SIZE = 12
  23. ;    opt    o+,w-
  24.  
  25.     incdir    coding:os3.1/include/
  26.     include    gst:os3_gst.i
  27.     include    intuition/icclass.i
  28.     include    libraries/gadtools.i
  29.     
  30.     easystart            * automatic WB startup code macro..
  31.     
  32. ;file read macro
  33. ;call with fileread filehandle,buffer,length
  34.  
  35. fileread    MACRO
  36.     movem.l    d1-d7/a0-a5,-(sp)
  37.     move.l    \1,d1
  38.     move.l    \2,d2
  39.     move.l    \3,d3
  40.     jsr    _LVORead(a6)
  41.     movem.l    (sp)+,d1-d7/a0-a5
  42.     cmp.l    \3,d0
  43.     bne    readerr
  44.     ENDM
  45.  
  46. ;file write macro
  47. ;call with filewrite filehandle,buffer,length
  48. filewrite    MACRO
  49.     movem.l    d1-d6/a0-a5,-(sp)
  50.     move.l    \1,d1
  51.     move.l    \2,d2
  52.     move.l    \3,d3
  53.     move.l    d3,d7
  54.     jsr    _LVOWrite(a6)
  55.     movem.l    (sp)+,d1-d6/a0-a5
  56.     cmp.l    d7,d0
  57.     bne    writeerr
  58.     ENDM
  59.  
  60. ;file skip macro
  61. ;call with fileskip handle,skip_amount
  62. ;note also that current seek position (after operation) is returned in D0
  63.  
  64. fileskip    MACRO
  65.     move.l    \1,d1
  66.     move.l    \2,d2
  67.     move.l    \2,d7
  68.     move.l    #OFFSET_CURRENT,d3
  69.     jsr    _LVOSeek(a6)
  70.     add.l    d7,d0
  71.     ENDM
  72.  
  73. ;file move macro
  74. ;call with filemove handle,offset
  75.  
  76. filemove    MACRO
  77.     move.l    dosbase,a6
  78.     move.l    \1,d1
  79.     move.l    \2,d2
  80.     move.l    #-1,d3
  81.     jsr    _LVOSeek(a6)
  82.     ENDM
  83.  
  84. ;    opt    o+,w-
  85.  
  86.     move.l    4.w,a6
  87.     lea    dosname,a1
  88.     jsr    _LVOOldOpenLibrary(a6)
  89.     move.l    d0,dosbase
  90.     beq.w    nodos
  91.     
  92.     move.l    dosbase,a6
  93.     jsr    _LVOOutput(a6)
  94.     move.l    d0,stdout
  95.     
  96.     move.l    4.w,a6
  97.     move.w    LIB_VERSION(a6),d0
  98.     cmp.w    #36,d0
  99.     blt.w    noks2
  100.     
  101.     move.l    4.w,a6
  102.     lea    intuiname,a1
  103.     move.l    #36,d0
  104.     jsr    _LVOOpenLibrary(a6)
  105.     move.l    d0,intuibase
  106.     beq.w    nointui
  107.     
  108.     move.l    4.w,a6
  109.     lea    gfxname,a1
  110.     move.l    #39,d0
  111.     jsr    _LVOOpenLibrary(a6)
  112.     move.l    d0,gfx39base
  113.  
  114.     move.l    4.w,a6
  115.     lea    gfxname,a1
  116.     move.l    #36,d0
  117.     jsr    _LVOOpenLibrary(a6)
  118.     move.l    d0,gfxbase
  119.     beq.w    nogfx
  120.     
  121.     lea    gadname,a1
  122.     move.l    #36,d0
  123.     jsr    _LVOOpenLibrary(a6)
  124.     move.l    d0,gadbase
  125.     beq.w    nogadt
  126.     
  127.     lea    dtname,a1
  128.     move.l    #36,d0
  129.     jsr    _LVOOpenLibrary(a6)
  130.     move.l    d0,dtbase
  131.     
  132.     move.l    4.w,a6
  133.     lea    reqtname,a1
  134.     moveq    #0,d0
  135.     jsr    _LVOOpenLibrary(a6)
  136.     move.l    d0,reqtbase
  137.     beq.w    noreqt
  138.     
  139.     move.w    #0,a0
  140.     moveq    #0,d0
  141.     move.l    reqtbase,a6
  142.     jsr    _LVOrtAllocRequestA(a6)
  143.     move.l    d0,req1
  144.     beq.w    noreqa1
  145.     
  146.     move.w    #0,a0
  147.     moveq    #0,d0
  148.     move.l    reqtbase,a6
  149.     jsr    _LVOrtAllocRequestA(a6)
  150.     move.l    d0,req2
  151.     beq.w    noreqa2
  152.     
  153.     move.l    #prefsname,d1
  154.     move.l    #MODE_OLDFILE,d2
  155.     move.l    dosbase,a6
  156.     jsr    _LVOOpen(a6)
  157.     tst.l    d0
  158.     beq.b    noprefs
  159.     
  160.     move.l    d0,d1
  161.     move.l    d0,d6
  162.     move.l    #oldprefs,d2
  163.     move.l    #endnewprefs-newprefs,d3
  164.     jsr    _LVORead(a6)
  165.     move.l    d0,d5
  166.     move.l    d6,d1
  167.     jsr    _LVOClose(a6)
  168.     
  169.     cmp.l    #endnewprefs-newprefs,d5
  170.     bne.b    noprefs
  171.     
  172.     lea    oldprefs,a0
  173.     lea    newprefs,a1
  174.     move.w    #endnewprefs-newprefs-1,d0
  175. copyprefs    move.b    (a0)+,(a1)+
  176.     dbf    d0,copyprefs
  177.     
  178. noprefs    move.l    reqtbase,a6
  179.     move.l    req1,a1
  180.     lea    loadtags,a0
  181.     jsr    _LVOrtChangeReqAttrA(a6)
  182.     
  183.     move.l    req2,a1
  184.     lea    savetags,a0
  185.     jsr    _LVOrtChangeReqAttrA(a6)
  186.     
  187.     move.l    #80*256*2,d0
  188.     move.l    #MEMF_CHIP|MEMF_CLEAR,d1
  189.     move.l    4.w,a6
  190.     jsr    _LVOAllocMem(a6)
  191.     tst.l    d0
  192.     beq.w    noram
  193.     
  194.     move.l    d0,pladdr
  195.     move.l    #80*256*2,plsize
  196.     move.w    #80,bytewid1
  197.     move.w    #640,pagewid
  198.     move.w    #256,pageht
  199.     move.w    #640,iffwidth
  200.     move.w    #256,iffheight
  201.     move.w    #2,iffdepth
  202.     move.b    #2,lightest
  203.     move.b    #1,darkest
  204.  
  205.     move.w    #2,d2
  206.     move.w    #80*256,d1
  207.     move.l    pladdr,d0
  208.     lea    bplptr,a1
  209. modi1    move.l    d0,(a1)+
  210.     add.l    d1,d0
  211.     sub.w    #1,d2
  212.     bne.b    modi1
  213.  
  214.     lea    newscreen,a0
  215.     move.l    intuibase,a6
  216.     jsr    _LVOOpenScreen(a6)
  217.     tst.l    d0
  218.     beq.w    noram
  219.     move.l    d0,scrpt1
  220.     move.l    d0,scrpt2
  221.     move.l    d0,scrpt3
  222.     move.l    d0,scrpt4
  223.     ;move.l    d0,scrpt5
  224.     
  225.     move.w    iffdepth,cdepth
  226.     move.w    cdepth,d0
  227.     move.w    #1,d1
  228.     lea    depthASCII,a0
  229.     bsr.w    numtohexasc
  230.     
  231.     move.l    #1,d0
  232.     move.w    iffdepth,d1
  233.     lsl.l    d1,d0
  234.     move.w    d0,d7
  235.     sub.w    #1,d7
  236.     lea    palstore1,a0
  237.     lea    palstore2,a1
  238.  
  239. pal    moveq    #0,d2
  240.     move.b    (a0)+,d1
  241.     and.b    #$F0,d1
  242.     lsr.b    #4,d1
  243.     or.b    d1,d2
  244.     lsl.w    #4,d2
  245.     move.b    (a0)+,d1
  246.     and.b    #$F0,d1
  247.     lsr.b    #4,d1
  248.     or.b    d1,d2
  249.     lsl.w    #4,d2
  250.     move.b    (a0)+,d1
  251.     and.b    #$F0,d1
  252.     lsr.b    #4,d1
  253.     or.b    d1,d2
  254.     move.w    d2,(a1)+
  255.     dbf    d7,pal
  256.     
  257.     lea    palstore2,a1
  258.     move.l    scrpt1,a0
  259.     lea    sc_ViewPort(a0),a0
  260.     move.l    gfxbase,a6
  261.     jsr    _LVOLoadRGB4(a6)
  262.     
  263.     lea    newwindow,a0
  264.     move.l    intuibase,a6
  265.     jsr    _LVOOpenWindow(a6)
  266.     move.l    d0,winpt1
  267.     move.l    d0,winpt2
  268.     move.l    d0,winpt3
  269.     move.l    d0,winpt4
  270.     beq.w    noram
  271.     
  272.     move.l    winpt1,a0
  273.     lea    menu1,a1
  274.     move.l    intuibase,a6
  275.     jsr    _LVOSetMenuStrip(a6)
  276.     
  277.     move.l    winpt1,a0
  278.     lea    mousept,a1
  279.     move.w    #15,d0
  280.     move.w    #15,d1
  281.     move.w    #-7,d2
  282.     move.w    #-7,d3
  283.     jsr    _LVOSetPointer(a6)
  284.     
  285.     move.l    winpt1,a1
  286.     move.l    wd_RPort(a1),a1
  287.     move.b    #RP_COMPLEMENT,d0
  288.     move.l    gfxbase,a6
  289.     jsr    _LVOSetDrMd(a6)
  290.     
  291.     lea    bitmap,a0
  292.     moveq    #0,d0
  293.     moveq    #0,d1
  294.     move.l    winpt1,a1
  295.     move.l    wd_RPort(a1),a1
  296.     clr.w    d2
  297.     clr.w    d3
  298.     
  299.     move.w    pagewid,d4
  300.     cmp.w    iffwidth,d4
  301.     blt.b    thinpic
  302.     move.w    iffwidth,d4
  303.     
  304. thinpic    move.w    pageht,d5
  305.     cmp.w    iffheight,d5
  306.     blt.b    shortpic
  307.     move.w    iffheight,d5
  308.     add.w    #$16,d5
  309.     
  310. shortpic    sub.w    #$16,d5
  311.     move.b    #$C0,d6
  312.     move.l    gfxbase,a6
  313.     jsr    _LVOBltBitMapRastPort(a6)
  314.     
  315.     clr.w    scrollx
  316.     clr.w    scrolly
  317. portwait    move.l    4.w,a6
  318.     move.l    winpt1,a0
  319.     move.l    wd_UserPort(a0),a0
  320.     jsr    _LVOWaitPort(a6)
  321.     
  322. nomessage1    move.l    winpt1,a0
  323.     move.l    wd_UserPort(a0),a0
  324.     move.l    4.w,a6
  325.     jsr    _LVOGetMsg(a6)
  326.     tst.l    d0
  327.     beq.b    portwait
  328.     
  329.     move.l    d0,message
  330.     move.l    d0,a1
  331.     jsr    _LVOReplyMsg(a6)
  332.     
  333.     move.l    message,a0
  334.     move.l    $14(a0),d0
  335.  
  336.     cmp.l    #MENUVERIFY,d0
  337.     beq.w    menuon
  338.  
  339.     cmp.l    #MENUPICK,d0
  340.     beq.w    menu
  341.     
  342.     cmp.l    #RAWKEY,d0
  343.     beq.w    rawkey
  344.     
  345.     cmp.l    #MOUSEMOVE,d0
  346.     beq.w    mousemove
  347.     
  348.     cmp.l    #MOUSEBUTTONS,d0
  349.     beq.b    mousebut
  350.      
  351.     bra.b    nomessage1
  352.  
  353. mousebut    not.b    lmbpress
  354.     beq.w    mouserel
  355.     tst.b    brushon
  356.     bne.w    brushset
  357.     tst.w    mousey
  358.     bge.b    mouseok
  359.     st    intopborder
  360.     bra.b    brushset
  361.  
  362. mouseok    sf    intopborder
  363.     tst.w    brtlx
  364.     bge.b    brushset
  365.     tst.w    brtly
  366.     bge.b    brushset
  367.     tst.w    brbrx
  368.     bge.b    brushset
  369.     tst.w    brbry
  370.     bge.b    brushset
  371.     move.w    mousex,brtlx
  372.     move.w    mousey,brtly
  373.     move.w    mousex,brbrx
  374.     move.w    mousey,brbry
  375.     move.w    scrollx,d0
  376.     move.w    scrolly,d1
  377.     add.w    d0,brtlx
  378.     add.w    d0,brbrx
  379.     add.w    d1,brtly
  380.     add.w    d1,brbry
  381.     bsr.w    updatecoords
  382.     bsr.w    drawbrushgrid
  383. brushset    bra.w    nomessage1
  384.  
  385. mouserel    tst.b    intopborder
  386.     bne.w    nomessage1
  387.     st    brushon
  388.     bra.w    nomessage1
  389.  
  390. mousemove    move.w    $20(a0),d6
  391.     move.w    $22(a0),d7
  392.     tst.w    mousex
  393.     bge.b    undrawcrosshair
  394.     tst.w    mousey
  395.     bge.b    undrawcrosshair
  396.     bra.b    noundraw
  397.  
  398. undrawcrosshair
  399.     bsr.w    drawcrosshair
  400.     move.w    #$FFFF,mousex
  401.     move.w    #$FFFF,mousey
  402. noundraw    tst.w    d7
  403.     blt.w    inborder
  404.     move.w    d7,d5
  405.     cmp.w    iffwidth,d6
  406.     bgt.w    inborder
  407.     cmp.w    iffheight,d5
  408.     bgt.w    inborder
  409.     move.w    d6,mousex
  410.     move.w    d7,mousey
  411.     tst.b    lmbpress
  412.     beq.b    nobrush
  413.     tst.b    intopborder
  414.     bne.b    nobrush
  415.     tst.b    brushon
  416.     bne.b    nobrush
  417.     bsr.w    drawbrushgrid
  418.  
  419. nobrush    lea    widASCII,a0
  420.     move.w    iffwidth,d0
  421.     bsr.w    numtoascii
  422.     lea    heightASCII,a0
  423.     move.w    iffheight,d0
  424.     bsr.w    numtoascii
  425.     lea    xASCII,a0
  426.     move.w    mousex,d0
  427.     add.w    scrollx,d0
  428.     bsr.w    numtoascii
  429.     lea    yASCII,a0
  430.     move.w    mousey,d0
  431.     add.w    scrolly,d0
  432.     bsr.w    numtoascii
  433.     
  434.     move.w    mousey,d1
  435.     add.w    scrolly,d1
  436.     mulu    bytewid1,d1
  437.  
  438.     move.b    #"A",addrmod-1
  439.     
  440.     cmp.b    #2,coordtype
  441.     bne.b    notilcoordtype
  442.     
  443.     move.b    #"I",addrmod-1
  444.     moveq    #0,d2
  445.     move.w    cdepth,d2
  446.     
  447.     move.l    d0,-(sp)
  448.     moveq    #0,d0
  449. mulu9    add.l    d2,d0
  450.     sub.l    #1,d1
  451.     bne.b    mulu9
  452.     move.l    d0,d1
  453.     move.l    (sp)+,d0
  454.     ;mulu.l    d2,d1    68000 cannot do this
  455.     
  456. notilcoordtype
  457.     moveq    #0,d0
  458.     move.w    mousex,d0
  459.     add.w    scrollx,d0
  460.     lsr.w    #3,d0
  461.     add.l    d0,d1
  462.     move.l    d1,d0
  463.     lea    addrmod,a0
  464.     bsr.w    numtoascii2
  465.     
  466.     bsr.w    writecoords
  467.     bsr.w    drawcrosshair
  468.     tst.b    lmbpress
  469.     beq.b    inborder
  470.     tst.b    brushon
  471.     bne.b    inborder
  472.     tst.b    intopborder
  473.     bne.b    inborder
  474.     move.w    mousex,brbrx
  475.     move.w    mousey,brbry
  476.     move.w    scrollx,d0
  477.     move.w    scrolly,d1
  478.     add.w    d0,brbrx
  479.     add.w    d1,brbry
  480.     bsr.b    drawbrushgrid
  481.     bsr.w    updatecoords
  482. inborder    bra.w    nomessage1
  483.  
  484. drawbrushgrid
  485.     move.w    brtlx,d0
  486.     sub.w    scrollx,d0
  487.     move.w    d0,brtlxoff
  488.     move.w    brbrx,d0
  489.     sub.w    scrollx,d0
  490.     move.w    d0,brbrxoff
  491.     move.w    brtly,d0
  492.     sub.w    scrolly,d0
  493.     move.w    d0,brtlyoff
  494.     move.w    brbry,d0
  495.     sub.w    scrolly,d0
  496.     move.w    d0,brbryoff
  497.     move.w    brtlxoff,d0
  498.     move.w    brtlyoff,d1
  499.     move.l    winpt1,a1
  500.     
  501.     move.l    wd_RPort(a1),a1
  502.     move.l    gfxbase,a6
  503.     jsr    _LVOMove(a6)
  504.     
  505.     move.w    brbrxoff,d0
  506.     move.w    brtlyoff,d1
  507.     move.l    winpt1,a1
  508.     move.l    wd_RPort(a1),a1
  509.     jsr    _LVODraw(a6)
  510.     
  511.     move.w    brbrxoff,d0
  512.     move.w    brbryoff,d1
  513.     move.l    winpt1,a1
  514.     move.l    wd_RPort(a1),a1
  515.     jsr    _LVODraw(a6)
  516.     
  517.     move.w    brtlxoff,d0
  518.     move.w    brbryoff,d1
  519.     move.l    winpt1,a1
  520.     move.l    wd_RPort(a1),a1
  521.     jsr    _LVODraw(a6)
  522.     
  523.     move.w    brtlxoff,d0
  524.     move.w    brtlyoff,d1
  525.     move.l    winpt1,a1
  526.     move.l    wd_RPort(a1),a1
  527.     jsr    _LVODraw(a6)
  528.     
  529.     move.w    brtlx,d6
  530.     sub.w    scrollx,d6
  531.     move.w    brbrx,d7
  532.     sub.w    scrollx,d7
  533.     
  534.     cmp.w    d6,d7
  535.     bge.b    noswap
  536.     exg    d6,d7
  537.     
  538. noswap    sub.w    #1,d6
  539. drawgrid    add.w    #$10,d6
  540.     cmp.w    d7,d6
  541.     bge.b    drawdone
  542.     move.w    d6,d0
  543.     move.w    brtlyoff,d1
  544.     move.l    winpt1,a1
  545.     move.l    wd_RPort(a1),a1
  546.     jsr    _LVOMove(a6)
  547.     
  548.     move.w    d6,d0
  549.     move.w    brbryoff,d1
  550.     move.l    winpt1,a1
  551.     move.l    wd_RPort(a1),a1
  552.     jsr    _LVODraw(a6)
  553.     bra.b    drawgrid
  554. drawdone    rts
  555.  
  556. drawcrosshair
  557.     move.l    gfxbase,a6
  558.     clr.w    d0
  559.     move.w    mousey,d1
  560.     move.l    winpt1,a1
  561.     move.l    wd_RPort(a1),a1
  562.     jsr    _LVOMove(a6)
  563.     
  564.     move.w    pagewid,d0
  565.     move.w    mousey,d1
  566.     move.l    winpt1,a1
  567.     move.l    wd_RPort(a1),a1
  568.     jsr    _LVODraw(a6)
  569.     
  570.     move.w    mousex,d0
  571.     clr.w    d1
  572.     move.l    winpt1,a1
  573.     move.l    wd_RPort(a1),a1
  574.     jsr    _LVOMove(a6)
  575.     
  576.     move.w    mousex,d0
  577.     move.w    pageht,d1
  578.     move.l    winpt1,a1
  579.     move.l    wd_RPort(a1),a1
  580.     jsr    _LVODraw(a6)
  581.     rts
  582.  
  583. updatecoords
  584.     tst.w    brtlx
  585.     bmi.b    clearbrushtxt
  586.     tst.w    brtly
  587.     bmi.b    clearbrushtxt
  588.     tst.w    brbrx
  589.     bmi.b    clearbrushtxt
  590.     tst.w    brbry
  591.     bmi.b    clearbrushtxt
  592.     bra.b    updatebrtxt
  593.  
  594. clearbrushtxt
  595.     move.b    #' ',brwidASCII
  596.     move.b    #' ',brwidASCII+1
  597.     move.b    #' ',brwidASCII+2
  598.     move.b    #' ',brwidASCII+3
  599.     move.b    #' ',brhtASCII
  600.     move.b    #' ',brhtASCII+1
  601.     move.b    #' ',brhtASCII+2
  602.     move.b    #' ',brhtASCII+3
  603.     bra.b    updatedone
  604.  
  605. updatebrtxt    move.w    brtlx,d0
  606.     sub.w    brbrx,d0
  607.     bpl.b    noswap1
  608.     neg.w    d0
  609. noswap1    add.w    #1,d0
  610.     lea    brwidASCII,a0
  611.     bsr.w    numtoascii
  612.     move.w    brtly,d0
  613.     sub.w    brbry,d0
  614.     bpl.b    noswap2
  615.     neg.w    d0
  616. noswap2    add.w    #1,d0
  617.     lea    brhtASCII,a0
  618.     bsr.w    numtoascii
  619. updatedone    bsr.w    writecoords
  620.     rts
  621.  
  622. rawkey    move.w    $18(a0),d0
  623.     lea    keytable,a0
  624. getroutine    move.w    (a0)+,d1
  625.     cmp.w    #$FFFF,d1
  626.     beq.b    cantfind
  627.     cmp.w    d0,d1
  628.     bne.b    notroutine
  629.     move.l    (a0),a1
  630.     movem.l    d0/a0,-(sp)
  631.     jsr    (a1)
  632.     movem.l    (sp)+,d0/a0
  633. notroutine    add.l    #4,a0
  634.     bra.b    getroutine
  635. cantfind    bra.w    nomessage1
  636.  
  637. altkey    not.b    altpressed
  638.     rts
  639.  
  640. ctrlkey    not.b    ctrlpressed
  641.     rts
  642.  
  643. scrollrt    tst.b    ctrlpressed
  644.     bne.w    farright
  645.     
  646.     tst.b    altpressed
  647.     bne.w    pageright
  648.     
  649.     move.w    iffwidth,d0
  650.     sub.w    pagewid,d0
  651.     sub.w    scrollx,d0
  652.     ble.b    noscroll2
  653.     move.w    #4,d1
  654.     cmp.w    #4,d0
  655.     bge.b    noscroll1
  656.     move.w    d0,d1
  657. noscroll1    add.w    d1,scrollx
  658.     bra.w    redraw
  659. noscroll2    rts
  660.  
  661. scrolllt    tst.b    ctrlpressed
  662.     bne.w    farleft
  663.     
  664.     tst.b    altpressed
  665.     bne.w    pageleft
  666.     
  667.     tst.w    scrollx
  668.     beq.b    noscroll4
  669.     move.w    #4,d1
  670.     cmp.w    #4,scrollx
  671.     bge.b    noscroll3
  672.     move.w    scrollx,d1
  673. noscroll3    sub.w    d1,scrollx
  674.     bra.w    redraw
  675. noscroll4    rts
  676.  
  677. scrolldn    tst.b    ctrlpressed
  678.     bne.w    verybottom
  679.     
  680.     tst.b    altpressed
  681.     bne.w    pagedown
  682.     
  683.     move.w    iffheight,d0
  684.     sub.w    pageht,d0
  685.     add.w    #$16,d0
  686.     sub.w    scrolly,d0
  687.     ble.b    noscroll6
  688.     move.w    #4,d1
  689.     cmp.w    #4,d0
  690.     bge.b    noscroll5
  691.     move.w    d0,d1
  692. noscroll5    add.w    d1,scrolly
  693.     bra.w    redraw
  694. noscroll6    rts
  695.  
  696. scrollup    tst.b    ctrlpressed
  697.     bne.b    verytop
  698.     
  699.     tst.b    altpressed
  700.     bne.w    pageup
  701.     
  702.     tst.w    scrolly
  703.     beq.b    noscroll8
  704.     move.w    #4,d1
  705.     cmp.w    #4,scrolly
  706.     bge.b    noscroll7
  707.     move.w    scrolly,d1
  708. noscroll7    sub.w    d1,scrolly
  709.     bra.w    redraw
  710. noscroll8    rts
  711.  
  712. farleft    tst.w    scrollx
  713.     beq.b    noscroll9
  714.     clr.w    scrollx
  715.     bra.w    redraw
  716. noscroll9    rts
  717.     
  718. verytop    tst.w    scrolly
  719.     beq.b    noscroll10
  720.     clr.w    scrolly
  721.     bra.w    redraw
  722. noscroll10    rts
  723.     
  724. farright    move.w    iffwidth,d0
  725.     sub.w    pagewid,d0
  726.     cmp.w    scrollx,d0
  727.     beq.b    noscroll11
  728.     move.w    d0,scrollx
  729.     bra.w    redraw
  730. noscroll11    rts
  731.  
  732. verybottom    move.w    iffheight,d0
  733.     sub.w    pageht,d0
  734.     add.w    #$16,d0
  735.     cmp.w    scrolly,d0
  736.     beq.b    noscroll12
  737.     move.w    d0,scrolly
  738.     bra.w    redraw
  739. noscroll12    rts
  740.  
  741. pageleft    tst.w    scrollx
  742.     beq.b    noscroll13
  743.     move.w    scrollx,d0
  744.     sub.w    pagewid,d0
  745.     bge.b    notle
  746.  
  747.     clr.w    d0
  748.  
  749. notle    move.w    d0,scrollx
  750.     bra.w    redraw
  751. noscroll13    rts
  752.  
  753.  
  754. pageright    move.w    iffwidth,d0
  755.     sub.w    pagewid,d0
  756.     cmp.w    scrollx,d0
  757.     beq.b    noscroll14
  758.     
  759.     move.w    scrollx,d0
  760.     add.w    pagewid,d0
  761.     move.w    d0,d1
  762.     add.w    pagewid,d1
  763.     cmp.w    iffwidth,d1
  764.     blt.b    notre
  765.     
  766.     move.w    iffwidth,d0
  767.     sub.w    pagewid,d0
  768.  
  769. notre    move.w    d0,scrollx
  770.     bra.b    redraw
  771. noscroll14    rts
  772.  
  773. pageup    tst.w    scrolly
  774.     beq.b    noscroll15
  775.     move.w    scrolly,d0
  776.     sub.w    pageht,d0
  777.     add.w    #$16,d0
  778.     bge.b    notte
  779.  
  780.     clr.w    d0
  781.  
  782. notte    move.w    d0,scrolly
  783.     bra.b    redraw
  784. noscroll15    rts
  785.  
  786. pagedown    move.w    iffheight,d0
  787.     sub.w    pageht,d0
  788.     add.w    #$16,d0
  789.     cmp.w    scrolly,d0
  790.     beq.b    noscroll16
  791.     
  792.     move.w    scrolly,d0
  793.     add.w    pageht,d0
  794.     sub.w    #$16,d0
  795.     move.w    d0,d1
  796.     add.w    pageht,d1
  797.     sub.w    #$16,d1
  798.     cmp.w    iffheight,d1
  799.     blt.b    notbe
  800.     
  801.     move.w    iffheight,d0
  802.     sub.w    pageht,d0
  803.     add.w    #$16,d0
  804.  
  805. notbe    move.w    d0,scrolly
  806.     bra.b    redraw
  807. noscroll16    rts
  808.  
  809.  
  810. redraw    tst.w    brtlx
  811.     bge.b    clearbr
  812.     tst.w    brtly
  813.     bge.b    clearbr
  814.     tst.w    brbrx
  815.     bge.b    clearbr
  816.     tst.w    brbry
  817.     bge.b    clearbr
  818.     bra.b    noclearbr
  819.  
  820. clearbr    bsr.w    drawbrushgrid
  821. noclearbr    bsr.w    drawcrosshair
  822.  
  823.     lea    bitmap,a0
  824.     moveq    #0,d0
  825.     move.w    scrollx,d0
  826.     moveq    #0,d1
  827.     move.w    scrolly,d1
  828.     move.l    winpt1,a1
  829.     move.l    wd_RPort(a1),a1
  830.     clr.w    d2
  831.     clr.w    d3
  832.     move.w    pagewid,d4
  833.     cmp.w    iffwidth,d4
  834.     blt.b    notwide
  835.     
  836.     move.w    iffwidth,d4
  837.     
  838. notwide    move.w    pageht,d5
  839.     cmp.w    iffheight,d5
  840.     blt.b    nottall
  841.     
  842.     move.w    iffheight,d5
  843.     add.w    #$16,d5
  844.     
  845. nottall    sub.w    #$16,d5
  846.     move.b    #$C0,d6
  847.     move.l    gfxbase,a6
  848.     jsr    _LVOBltBitMapRastPort(a6)
  849.     
  850.     tst.w    brtlx
  851.     bge.b    putbr
  852.     tst.w    brtly
  853.     bge.b    putbr
  854.     tst.w    brbrx
  855.     bge.b    putbr
  856.     tst.w    brbry
  857.     bge.b    putbr
  858.     bra.b    noputbr
  859.  
  860. putbr    tst.b    brushon
  861.     bne.b    brushlocked
  862.     move.w    mousex,brbrx
  863.     move.w    mousey,brbry
  864.     move.w    scrollx,d0
  865.     move.w    scrolly,d1
  866.     add.w    d0,brbrx
  867.     add.w    d1,brbry
  868.  
  869. brushlocked    bsr.w    drawbrushgrid
  870. noputbr    bsr.w    drawcrosshair
  871.  
  872.     lea    widASCII,a0
  873.     move.w    iffwidth,d0
  874.     bsr.w    numtoascii
  875.     lea    heightASCII,a0
  876.     move.w    iffheight,d0
  877.     bsr.w    numtoascii
  878.     lea    xASCII,a0
  879.     move.w    mousex,d0
  880.     add.w    scrollx,d0
  881.     bsr.w    numtoascii
  882.     lea    yASCII,a0
  883.     move.w    mousey,d0
  884.     add.w    scrolly,d0
  885.     bsr.w    numtoascii
  886.     bsr.w    writecoords
  887.     rts
  888.  
  889. menuon    lea    menupal,a1
  890.     move.l    scrpt1,a0
  891.     lea    sc_ViewPort(a0),a0
  892.     move.l    #4,d0
  893.     move.l    gfxbase,a6
  894.     jsr    _LVOLoadRGB4(a6)
  895.     bra.w    nomessage1
  896.     
  897. menu    bsr.w    fakebpl
  898.     move.l    message,a0
  899.     move.w    $18(a0),d0
  900.     move.w    d0,d1
  901.     and.w    #%0000000000000001,d1
  902.     move.w    d0,d2
  903.     and.w    #%0000000111100000,d2
  904.     lsr.w    #5,d2
  905.     and.w    #%1111111100000000,d0
  906.     lsr.w    #8,d0
  907.     lsr.w    #3,d0
  908.     
  909.     cmp.w    #0,d1
  910.     bne.b    menu2sel
  911.     tst.w    d2
  912.     beq.b    load
  913.     cmp.w    #1,d2
  914.     beq.w    savepic
  915.     cmp.w    #2,d2
  916.     beq.w    savebr
  917.     cmp.w    #3,d2
  918.     beq.w    savesprite
  919.     cmp.w    #5,d2
  920.     beq.w    screenmode
  921.     cmp.w    #6,d2
  922.     beq.w    prefs
  923.     cmp.w    #7,d2
  924.     beq.w    about
  925.     cmp.w    #9,d2
  926.     beq.w    close
  927.     bra.w    nomessage1
  928.  
  929. menu2sel    tst.w    d2
  930.     beq.w    brush
  931.     cmp.w    #1,d2
  932.     beq.w    palette
  933.     cmp.w    #3,d2
  934.     beq.w    savepal
  935.     cmp.w    #4,d2
  936.     beq.w    savebrmask
  937.     cmp.w    #5,d2
  938.     beq.w    savepicmask
  939.     bra.w    nomessage1
  940.  
  941. load    clr.b    filename
  942.     move.l    req1,a1
  943.     lea    filename,a2
  944.     lea    loadtxt,a3
  945.     lea    tags2,a0
  946.     move.l    reqtbase,a6
  947.     jsr    _LVOrtFileRequestA(a6)
  948.     tst.l    d0
  949.     beq.w    nomessage1
  950.     
  951.     move.l    req1,a1
  952.     move.l    rtfi_Dir(a1),d1
  953.     move.l    #SHARED_LOCK,d2
  954.     move.l    dosbase,a6
  955.     jsr    _LVOLock(a6)
  956.     move.l    d0,filelock
  957.     beq.w    readerr
  958.     
  959.     move.l    d0,d1
  960.     jsr    _LVOCurrentDir(a6)
  961.     move.l    d0,olddirlock
  962.     
  963.     move.l    #filename,d1
  964.     move.l    #MODE_OLDFILE,d2
  965.     move.l    dosbase,a6
  966.     jsr    _LVOOpen(a6)
  967.     tst.l    d0
  968.     beq.w    readerr
  969.     move.l    d0,handle1
  970.     
  971.     fileread    handle1,#store1,#4
  972.     cmp.l    #'FORM',store1
  973.     bne.w    notiff
  974.     
  975.     fileread    handle1,#store1,#4
  976.     sub.l    #4,store1
  977.     move.l    store1,iffend
  978.     
  979.     fileread    handle1,#store1,#4
  980.     cmp.l    #'ILBM',store1
  981.     bne.w    notiff
  982.     
  983. findbmhd    fileread    handle1,#store1,#4
  984.     cmp.l    #'BMHD',store1
  985.     beq.w    bmhdfound
  986.     
  987.     fileread    handle1,#store1,#4
  988.     fileskip    handle1,store1
  989.     move.l    d0,seekpos
  990.     
  991.     move.l    d0,d1
  992.     add.l    #1,d0
  993.     and.l    #$FFFFFFFE,d0
  994.     sub.l    d1,d0
  995.     beq.b    nopad
  996.     
  997.     fileskip    handle1,#1
  998.     
  999. nopad    move.l    seekpos,d0
  1000.     sub.l    #12,d0
  1001.     cmp.l    iffend,d0
  1002.     beq.w    notiff
  1003.     bra.w    findbmhd
  1004.  
  1005. bmhdfound    fileskip    handle1,#4
  1006.  
  1007.     fileread    handle1,#store1,#2
  1008.     move.w    store1,iffwidth
  1009.     
  1010.     fileread    handle1,#store1,#2
  1011.     move.w    store1,iffheight
  1012.     
  1013.     fileskip    handle1,#4
  1014.     moveq    #0,d0
  1015.     
  1016.     fileread    handle1,#store1,#1
  1017.     move.b    store1,d0
  1018.     move.w    d0,iffdepth
  1019.     
  1020.     fileread    handle1,#store1,#1
  1021.     move.b    store1,mask
  1022.     
  1023.     fileread    handle1,#store1,#1
  1024.     move.b    store1,comp
  1025.     move.l    handle1,d1
  1026.     
  1027.     fileskip    handle1,#1
  1028.     fileskip    handle1,#2
  1029.     
  1030.     fileread    handle1,#store1,#2
  1031.     move.w    store1,aspects
  1032.     
  1033.     fileread    handle1,#store1,#2
  1034.     move.w    store1,pagewid
  1035.     
  1036.     fileread    handle1,#store1,#2
  1037.     move.w    store1,pageht
  1038.     
  1039.     moveq    #0,d0
  1040.     move.w    iffwidth,d0
  1041.     add.w    #15,d0
  1042.     divu    #16,d0
  1043.     add.w    d0,d0
  1044.     move.w    d0,bytewid1
  1045.     
  1046.     moveq    #0,d0
  1047.     move.w    iffwidth,d0
  1048.     move.w    d0,width
  1049.     add.w    #15,d0
  1050.     divu    #16,d0
  1051.     add.w    d0,d0
  1052.     move.w    d0,bytewid2
  1053.     
  1054.     move.w    bytewid2,d0
  1055.     move.w    iffheight,d1
  1056.     move.w    d1,height
  1057.     mulu    d1,d0
  1058.     moveq    #0,d1
  1059.     move.w    iffdepth,d1
  1060.     
  1061.     move.l    d2,-(sp)
  1062.     moveq    #0,d2
  1063. mulu1    add.l    d0,d2
  1064.     sub.l    #1,d1
  1065.     bne.b    mulu1
  1066.     move.l    d2,d0
  1067.     move.l    (sp)+,d2
  1068.     ;mulu.l    d1,d0    68000 cannot do this
  1069.     
  1070.     move.l    plsize,oldplsize
  1071.     move.l    d0,plsize
  1072.     
  1073.     filemove    handle1,#12
  1074.  
  1075. findcamg    fileread    handle1,#store1,#4
  1076.     cmp.l    #'CAMG',store1
  1077.     beq.w    camgfound
  1078.     
  1079.     fileread    handle1,#store1,#4
  1080.     fileskip    handle1,store1
  1081.     move.l    d0,seekpos
  1082.     
  1083.     move.l    d0,d1
  1084.     add.l    #1,d0
  1085.     and.l    #$FFFFFFFE,d0
  1086.     sub.l    d1,d0
  1087.     beq.b    nopad3
  1088.     move.l    handle1,d1
  1089.     
  1090.     fileskip    handle1,#1
  1091.     
  1092. nopad3    move.l    seekpos,d0
  1093.     sub.l    #12,d0
  1094.     cmp.l    iffend,d0
  1095.     beq.b    nocamg
  1096.     bra.w    findcamg
  1097.  
  1098. nocamg    move.l    #0,iffcamg    ;standard lores 320x256
  1099.     bra.b    camgdone
  1100.  
  1101. camgfound    fileskip    handle1,#4
  1102.  
  1103.     fileread    handle1,#iffcamg,#4
  1104.  
  1105. camgdone    filemove    handle1,#12
  1106.  
  1107.  
  1108. findcmap    fileread    handle1,#store1,#4
  1109.     cmp.l    #'CMAP',store1
  1110.     beq.w    cmapfound
  1111.     
  1112.     fileread    handle1,#store1,#4
  1113.     fileskip    handle1,store1
  1114.     move.l    d0,seekpos
  1115.     
  1116.     move.l    d0,d1
  1117.     add.l    #1,d0
  1118.     and.l    #$FFFFFFFE,d0
  1119.     sub.l    d1,d0
  1120.     beq.b    nopad2
  1121.     
  1122.     fileskip    handle1,#1
  1123.     
  1124. nopad2    move.l    seekpos,d0
  1125.     sub.l    #12,d0
  1126.     cmp.l    iffend,d0
  1127.     beq.w    notiff
  1128.     bra.w    findcmap
  1129.  
  1130. cmapfound    fileread    handle1,#store1,#4
  1131.  
  1132.     move.l    store1,d7
  1133.     lea    palstore1,a5
  1134.     moveq    #0,d5
  1135.     moveq    #0,d2
  1136.     move.l    #$7fff,d4
  1137.  
  1138. copypal    fileread    handle1,#store1,#3
  1139.     move.b    store1,(a5)+
  1140.     move.b    store1+1,(a5)+
  1141.     move.b    store1+2,(a5)+
  1142.     moveq    #0,d6
  1143.     clr.w    d3
  1144.     move.b    store1,d6
  1145.     move.b    store1+1,d3
  1146.     add.w    d3,d6
  1147.     move.b    store1+2,d3
  1148.     add.w    d3,d6
  1149.     
  1150.     move.w    iffdepth,d1
  1151.     
  1152.     move.l    iffcamg,d0
  1153.     and.l    #$800,d0
  1154.     beq.b    notham
  1155.     
  1156.     sub.w    #2,d1
  1157.     
  1158. notham    and.l    #$80,d0
  1159.     beq.b    nothbr
  1160.     
  1161.     sub.w    #1,d1
  1162.  
  1163. nothbr    move.l    #1,d0
  1164.     lsl.w    d1,d0
  1165.     
  1166.     cmp.w    d0,d2
  1167.     bge.b    outofrange
  1168.     
  1169.     cmp.w    d6,d5
  1170.     bge.b    notlight
  1171.     
  1172.     move.w    d6,d5
  1173.     move.b    d2,lightest
  1174.     
  1175. notlight    cmp.w    d6,d4
  1176.     ble.b    notdark
  1177.     
  1178.     move.w    d6,d4
  1179.     move.b    d2,darkest
  1180.  
  1181. outofrange
  1182. notdark    add.l    #1,d2
  1183.     sub.w    #3,d7
  1184.     bne.w    copypal
  1185.     
  1186.     move.l    intuibase,a6
  1187.     move.l    winpt1,a0
  1188.     jsr    _LVOClearMenuStrip(a6)
  1189.     
  1190.     move.l    winpt1,a0
  1191.     jsr    _LVOCloseWindow(a6)
  1192.     clr.l    winpt1
  1193.     
  1194.     move.l    scrpt1,a0
  1195.     jsr    _LVOCloseScreen(a6)
  1196.  
  1197.     clr.l    scrpt1
  1198.  
  1199.     tst.l    pladdr
  1200.     beq.b    nobplns1
  1201.     
  1202.     move.l    pladdr,a1
  1203.     move.l    oldplsize,d0
  1204.     move.l    4.w,a6
  1205.     jsr    _LVOFreeMem(a6)
  1206.     clr.l    pladdr
  1207.     
  1208. nobplns1    move.w    bytewid2,bytesperrow
  1209.     move.w    height,height2
  1210.     move.w    iffdepth,d0
  1211.     move.b    d0,scdepth
  1212.  
  1213.     move.l    plsize,d0
  1214.     move.l    #MEMF_CHIP|MEMF_CLEAR,d1
  1215.     move.l    4.w,a6
  1216.     jsr    _LVOAllocMem(a6)
  1217.     tst.l    d0
  1218.     beq.w    noplram
  1219.     move.l    d0,pladdr
  1220.  
  1221.     move.w    iffdepth,d2
  1222.     move.w    bytewid2,d1
  1223.     mulu    height,d1
  1224.     move.l    pladdr,d0
  1225.     lea    bplptr,a1
  1226.     
  1227. modibpl1    move.l    d0,(a1)+
  1228.     add.l    d1,d0
  1229.     sub.w    #1,d2
  1230.     bne.b    modibpl1
  1231.     
  1232.     move.w    pagewid,scrwid
  1233.     move.w    pagewid,winwidth
  1234.     move.w    pageht,scrht
  1235.     move.w    pageht,winheight
  1236.     sub.w    #22,winheight
  1237.  
  1238.     move.w    iffdepth,scrdepth
  1239.     move.l    iffcamg,d0
  1240.  
  1241. camgmask    equ    ~(V_SPRITES|V_VP_HIDE|GENLOCK_AUDIO|GENLOCK_VIDEO|MONITOR_ID_MASK)
  1242.  
  1243.     and.l    #camgmask,d0
  1244.     move.l    d0,scrvmodes
  1245.     
  1246.     move.l    intuibase,a6
  1247.     lea    newscreen,a0
  1248.     jsr    _LVOOpenScreen(a6)
  1249.     tst.l    d0
  1250.     beq.w    noram
  1251.     move.l    d0,scrpt1
  1252.     move.l    d0,scrpt2
  1253.     move.l    d0,scrpt3
  1254.     move.l    d0,scrpt4
  1255.     ;move.l    d0,scrpt5
  1256.     
  1257.     move.w    iffdepth,cdepth
  1258.     move.w    cdepth,d0
  1259.     move.w    #1,d1
  1260.     lea    depthASCII,a0
  1261.     bsr.w    numtohexasc
  1262.     
  1263.     lea    newwindow,a0
  1264.     move.l    intuibase,a6
  1265.     jsr    _LVOOpenWindow(a6)
  1266.     move.l    d0,winpt1
  1267.     move.l    d0,winpt2
  1268.     move.l    d0,winpt3
  1269.     move.l    d0,winpt4
  1270.     beq.w    noram
  1271.  
  1272.     move.w    pageht,d0
  1273.     sub.w    #50,d0
  1274.     lsr.w    #1,d0
  1275.     move.w    d0,loadwiny
  1276.     move.w    pagewid,d0
  1277.     sub.w    #280,d0
  1278.     lsr.w    #1,d0
  1279.     move.w    d0,loadwinx
  1280.     move.l    #lwintitle,windowtitle
  1281.     
  1282.     lea    newloadwin,a0
  1283.     move.l    intuibase,a6
  1284.     jsr    _LVOOpenWindow(a6)
  1285.     move.l    d0,lswindow
  1286.     bsr.w    drawLSwin
  1287.     
  1288.     move.l    winpt1,a0
  1289.     lea    menu1,a1
  1290.     move.l    intuibase,a6
  1291.     jsr    _LVOSetMenuStrip(a6)
  1292.     
  1293.     move.l    winpt1,a0
  1294.     lea    mousept,a1
  1295.     move.w    #15,d0
  1296.     move.w    #15,d1
  1297.     move.w    #-8,d2
  1298.     move.w    #-7,d3
  1299.     jsr    _LVOSetPointer(a6)
  1300.     
  1301.     move.l    winpt1,a1
  1302.     move.l    wd_RPort(a1),a1
  1303.     move.b    #RP_COMPLEMENT,d0
  1304.     move.l    gfxbase,a6
  1305.     jsr    _LVOSetDrMd(a6)
  1306.     
  1307.     move.w    #$FFFF,brtlx
  1308.     move.w    #$FFFF,brtly
  1309.     move.w    #$FFFF,brbrx
  1310.     move.w    #$FFFF,brbry
  1311.     sf    brushon
  1312.     bsr.w    updatecoords
  1313.     
  1314.     filemove    handle1,#12
  1315.     
  1316. findbody    fileread    handle1,#store1,#4
  1317.     cmp.l    #'BODY',store1
  1318.     beq.w    bodyfound
  1319.     
  1320.     fileread    handle1,#store1,#4
  1321.     fileskip    handle1,store1
  1322.     move.l    d0,seekpos
  1323.     
  1324.     move.l    d0,d1
  1325.     add.l    #1,d0
  1326.     and.l    #$FFFFFFFE,d0
  1327.     sub.l    d1,d0
  1328.     beq.b    nopad4
  1329.     
  1330.     fileskip    handle1,#1
  1331.     
  1332. nopad4    move.l    seekpos,d0
  1333.     sub.l    #12,d0
  1334.     cmp.l    iffend,d0
  1335.     beq.w    notiff
  1336.     bra.w    findbody
  1337.  
  1338. bodyfound    tst.b    comp
  1339.     beq.w    nocomp
  1340.     
  1341.     fileread    handle1,#store1,#4
  1342.     move.l    store1,bodylen
  1343.     
  1344.     move.l    #copybuffend,buffptr
  1345.     moveq    #0,d3
  1346.     move.l    pladdr,a1
  1347.     moveq    #0,d2
  1348.     move.w    iffheight,d2
  1349.  
  1350.     cmp.b    #1,mask
  1351.     bne.b    nomaskpl
  1352.     
  1353.     add.w    #1,iffdepth
  1354. nomaskpl
  1355. nextline    move.w    iffheight,maxline
  1356.     move.w    d2,lineno
  1357.     bsr.w    updateLSwin
  1358.  
  1359.     move.w    iffdepth,d1
  1360.     sub.w    #1,d1
  1361. nextplane    move.w    bytewid1,d4
  1362.     sub.w    #1,d4
  1363.  
  1364. next    move.l    buffptr,a0
  1365.     cmp.l    #copybuffend,a0
  1366.     bne.b    notend1
  1367.  
  1368.     movem.l    d1-d7/a0-a5,-(sp)
  1369.     move.l    handle1,d1
  1370.     move.l    #copybuff,d2
  1371.     move.l    #1024*8,d3
  1372.     cmp.l    #1024*8,bodylen
  1373.     bge.b    noeof1
  1374.     move.l    bodylen,d3
  1375. noeof1    sub.l    d3,bodylen
  1376.     move.l    d3,lenstore
  1377.     
  1378.     jsr    _LVORead(a6)
  1379.     movem.l    (sp)+,d1-d7/a0-a5
  1380.     cmp.l    lenstore,d0
  1381.     bne.w    readerr
  1382.     lea    copybuff,a0
  1383.  
  1384. notend1    move.b    (a0)+,d7
  1385.     move.l    a0,buffptr
  1386.     tst.b    d7
  1387.     bpl.w    copy
  1388.     
  1389.     move.l    buffptr,a0
  1390.     cmp.l    #copybuffend,a0
  1391.     bne.b    notend2
  1392.  
  1393.     movem.l    d1-d7/a0-a5,-(sp)
  1394.     move.l    handle1,d1
  1395.     move.l    #copybuff,d2
  1396.     move.l    #1024*8,d3
  1397.     cmp.l    #1024*8,bodylen
  1398.     bge.b    noeof2
  1399.     move.l    bodylen,d3
  1400. noeof2    sub.l    d3,bodylen
  1401.     move.l    d3,lenstore
  1402.     
  1403.     jsr    _LVORead(a6)
  1404.     movem.l    (sp)+,d1-d7/a0-a5
  1405.     cmp.l    lenstore,d0
  1406.     bne.w    readerr
  1407.     lea    copybuff,a0
  1408.  
  1409. notend2    move.b    (a0)+,d6
  1410.     move.l    a0,buffptr
  1411.     
  1412.     ext.w    d7
  1413.     neg.w    d7
  1414.     add.w    #1,d7
  1415.     sub.w    d7,d4
  1416.     sub.w    #1,d7
  1417.     
  1418. replicate    tst.w    d1
  1419.     bne.b    nolastpl
  1420.     cmp.b    #1,mask
  1421.     bne.b    nolastpl
  1422.     add    #1,a1
  1423.     bra.b    nop1
  1424.         
  1425. nolastpl    move.b    d6,(a1)+
  1426. nop1    dbf    d7,replicate
  1427.     bra.w    testend
  1428.  
  1429. copy    ext.w    d7
  1430.     and.l    #$FFFF,d7
  1431.     add.w    #1,d7
  1432.     sub.w    d7,d4
  1433.     
  1434.     sub.l    #1,d7
  1435.     move.l    buffptr,a0
  1436.     
  1437. copybyte    cmp.l    #copybuffend,a0
  1438.     bne.b    notend3
  1439.  
  1440.     movem.l    d1-d7/a0-a5,-(sp)
  1441.     move.l    handle1,d1
  1442.     move.l    #copybuff,d2
  1443.     move.l    #1024*8,d3
  1444.     cmp.l    #1024*8,bodylen
  1445.     bge.b    noeof3
  1446.     move.l    bodylen,d3
  1447. noeof3    sub.l    d3,bodylen
  1448.     move.l    d3,lenstore
  1449.     
  1450.     jsr    _LVORead(a6)
  1451.     movem.l    (sp)+,d1-d7/a0-a5
  1452.     cmp.l    lenstore,d0
  1453.     bne.w    readerr
  1454.     lea    copybuff,a0
  1455.     
  1456. notend3    tst.w    d1
  1457.     bne.b    notlastpl2
  1458.     
  1459.     cmp.b    #1,mask
  1460.     bne.b    notlastpl2
  1461.     add.l    #1,a0
  1462.     add.l    #1,a1
  1463.     bra.b    nop2
  1464.     
  1465. notlastpl2    move.b    (a0)+,(a1)+
  1466. nop2    dbf    d7,copybyte
  1467.     move.l    a0,buffptr
  1468.  
  1469. testend    tst.w    d4
  1470.     bge.w    next
  1471.     cmp.w    #$FFFF,d4
  1472.     beq.b    noerr
  1473.     bra.w    corrupterr
  1474.  
  1475. noerr    moveq    #0,d7
  1476.     move.w    bytewid1,d7
  1477.     sub.l    d7,a1
  1478.     move.w    bytewid2,d7
  1479.     mulu    height,d7
  1480.     add.l    d7,a1
  1481.     dbf    d1,nextplane
  1482.  
  1483.     move.w    bytewid2,d7
  1484.     mulu    height,d7
  1485.     
  1486.     move.l    d1,-(sp)
  1487.     moveq    #0,d1
  1488.     move.w    iffdepth,d1
  1489.     
  1490.     move.l    d2,-(sp)
  1491.     moveq    #0,d2
  1492. mulu2    add.l    d7,d2
  1493.     sub.l    #1,d1
  1494.     bne.b    mulu2
  1495.     move.l    d2,d7
  1496.     move.l    (sp)+,d2
  1497.     ;mulu.l    d1,d7    68000 cannot do this
  1498.     
  1499.     move.l    (sp)+,d1
  1500.     
  1501.     sub.l    d7,a1
  1502.     move.w    bytewid2,d4
  1503.     lea    0(a1,d4.w),a1
  1504.     
  1505.     sub.l    #1,d2
  1506.     bne.w    nextline
  1507.     
  1508.     cmp.b    #1,mask
  1509.     bne.b    nomaskpl2
  1510.     sub.w    #1,iffdepth
  1511.     
  1512. nomaskpl2    bra.w    bodydone
  1513.  
  1514.  
  1515. nocomp    fileread    handle1,#store1,#4
  1516.     move.l    store1,bodylen
  1517.     
  1518.     move.l    pladdr,a1
  1519.     moveq    #0,d5
  1520.     moveq    #0,d2
  1521.     move.w    iffheight,d2
  1522. nextline2    move.w    d2,lineno
  1523.     move.w    iffheight,maxline
  1524.     bsr.w    updateLSwin
  1525.  
  1526.     move.w    iffdepth,d1
  1527.     sub.w    #1,d1
  1528.     
  1529. nextplane2    move.w    bytewid1,d3
  1530.     fileread    handle1,a1,d3
  1531.     
  1532.     move.w    bytewid2,d7
  1533.     mulu    height,d7
  1534.     add.l    d7,a1
  1535.     dbf    d1,nextplane2
  1536.     
  1537.     cmp.b    #1,mask
  1538.     bne.b    nomask2
  1539.     
  1540.     fileskip    handle1,bytewid1
  1541.     
  1542. nomask2    move.w    bytewid2,d7
  1543.     mulu    height,d7
  1544.     
  1545.     moveq    #0,d1
  1546.     move.w    iffdepth,d1
  1547.     move.l    d2,-(sp)
  1548.     moveq    #0,d2
  1549. mulu3    add.l    d7,d2
  1550.     sub.l    #1,d1
  1551.     bne.b    mulu3
  1552.     move.l    d2,d7
  1553.     move.l    (sp)+,d2
  1554.     ;mulu.l    d1,d7    68000 cannot do this
  1555.     
  1556.     move.l    handle1,d1
  1557.     sub.l    d7,a1
  1558.     
  1559.     move.w    bytewid2,d4
  1560.     lea    0(a1,d4.w),a1
  1561.     
  1562.     sub.l    #1,d2
  1563.     bne.w    nextline2
  1564.     
  1565. bodydone    bsr.w    closeLSwin
  1566.     bsr.w    closefile
  1567.  
  1568.     lea    pal32,a0
  1569.     move.w    #258-1,d0
  1570. clearpal    clr.l    (a0)+
  1571.     dbf    d0,clearpal
  1572.     
  1573.     tst.l    gfx39base
  1574.     beq.b    nogfx39
  1575.     
  1576.     move.l    gfx39base,a6
  1577.     move.l    #1,d0
  1578.     move.w    iffdepth,d1
  1579.     
  1580.     lsl.l    d1,d0
  1581.     lea    pal32,a1
  1582.     move.w    d0,d7
  1583.     mulu    #3,d7
  1584.     sub.w    #1,d7
  1585.     
  1586.     move.w    d0,(a1)+
  1587.     clr.w    (a1)+
  1588.     lea    palstore1,a0
  1589.     
  1590. convpal    move.b    (a0)+,d0
  1591.     and.l    #$FF,d0
  1592.     swap    d0
  1593.     lsl.l    #8,d0
  1594.     move.l    d0,(a1)+
  1595.     dbf    d7,convpal
  1596.     
  1597.     clr.l    (a1)+
  1598.     lea    pal32,a1
  1599.     move.l    scrpt1,a0
  1600.     lea    sc_ViewPort(a0),a0
  1601.     jsr    _LVOLoadRGB32(a6)
  1602.     bra.b    doblit
  1603.  
  1604. nogfx39    move.l    gfxbase,a6
  1605.     
  1606.     move.l    #1,d0
  1607.     move.w    iffdepth,d1
  1608.     
  1609.     lsl.l    d1,d0
  1610.     move.w    d0,d7
  1611.     sub.w    #1,d7
  1612.     
  1613.     lea    palstore1,a0
  1614.     lea    palstore2,a1
  1615.     
  1616. convpal2    moveq    #0,d2
  1617.     move.b    (a0)+,d1
  1618.     and.b    #$F0,d1
  1619.     lsr.b    #4,d1
  1620.     or.b    d1,d2
  1621.     lsl.w    #4,d2
  1622.     move.b    (a0)+,d1
  1623.     and.b    #$F0,d1
  1624.     lsr.b    #4,d1
  1625.     or.b    d1,d2
  1626.     lsl.w    #4,d2
  1627.     move.b    (a0)+,d1
  1628.     and.b    #$F0,d1
  1629.     lsr.b    #4,d1
  1630.     or.b    d1,d2
  1631.     move.w    d2,(a1)+
  1632.     dbf    d7,convpal2
  1633.     
  1634.     lea    palstore2,a1
  1635.     move.l    scrpt1,a0
  1636.     lea    sc_ViewPort(a0),a0
  1637.     jsr    _LVOLoadRGB4(a6)
  1638.     
  1639. doblit    lea    bitmap,a0
  1640.     moveq    #0,d0
  1641.     moveq    #0,d1
  1642.     move.l    winpt1,a1
  1643.     move.l    wd_RPort(a1),a1
  1644.     clr.w    d2
  1645.     clr.w    d3
  1646.     move.w    pagewid,d4
  1647.     cmp.w    iffwidth,d4
  1648.     blt.b    notwide1
  1649.     
  1650.     move.w    iffwidth,d4
  1651.     
  1652. notwide1    move.w    pageht,d5
  1653.     cmp.w    iffheight,d5
  1654.     blt.b    nothigh1
  1655.     
  1656.     move.w    iffheight,d5
  1657.     add.w    #$16,d5
  1658.     
  1659. nothigh1    sub.w    #$16,d5
  1660.     move.b    #$C0,d6
  1661.     jsr    _LVOBltBitMapRastPort(a6)
  1662.  
  1663.     clr.w    scrollx
  1664.     clr.w    scrolly
  1665.     move.w    #$FFFF,mousey
  1666.     move.w    #$FFFF,mousex
  1667.     bra.w    nomessage1
  1668.  
  1669. corrupterr    lea    bodyfmt5,a1
  1670.     lea    gadfmt5,a2
  1671.     lea    taglist,a0
  1672.     lea    0,a3
  1673.     lea    0,a4
  1674.     move.l    reqtbase,a6
  1675.     jsr    _LVOrtEZRequestA(a6)
  1676.     bra.w    bodydone
  1677.  
  1678. readerr    bsr.w    closeLSwin
  1679.     bsr.w    closefile
  1680.  
  1681.     lea    bodyfmt2,a1
  1682.     lea    gadfmt2,a2
  1683.     lea    taglist,a0
  1684.     lea    0,a3
  1685.     lea    0,a4
  1686.     move.l    reqtbase,a6
  1687.     jsr    _LVOrtEZRequestA(a6)
  1688.     bra.w    nomessage1
  1689.  
  1690. noplram    tst.l    dtobject
  1691.     beq.b    nodtobj2
  1692.     move.l    winpt1,a0
  1693.     move.l    dtobject,a1
  1694.     jsr    _LVORemoveDTObject(a6)
  1695.     
  1696.     move.l    dtobject,a0
  1697.     jsr    _LVODisposeDTObject(a6)
  1698.  
  1699. nodtobj2    bsr.w    closeLSwin
  1700.  
  1701.     lea    bodyfmt4,a1
  1702.     lea    gadfmt4,a2
  1703.     lea    taglist,a0
  1704.     lea    0,a3
  1705.     lea    0,a4
  1706.     move.l    reqtbase,a6
  1707.     jsr    _LVOrtEZRequestA(a6)
  1708.     bra.w    nomessage1
  1709.  
  1710. notiff    tst.l    dtbase
  1711.     beq.w    unknowntype
  1712.     
  1713.     move.l    dtbase,a6
  1714.     move.l    #filename,d0
  1715.     lea    dttags,a0
  1716.     jsr    _LVONewDTObjectA(a6)
  1717.     tst.l    d0
  1718.     beq.w    unknowntype
  1719.     move.l    d0,dtobject
  1720.     
  1721.     move.l    dtobject,a0
  1722.     lea    dtattrs,a2
  1723.     jsr    _LVOGetDTAttrsA(a6)
  1724.     
  1725.     move.l    dtwidth,d0
  1726.     move.w    d0,iffwidth
  1727.     move.l    d0,dtwidmod
  1728.     move.l    dtheight,d0
  1729.     move.w    d0,iffheight
  1730.     move.l    d0,dthtmod
  1731.     sub.l    #22,dthtmod
  1732.     
  1733.     move.l    bmhdaddr,a0    ;get address of BMHD
  1734.     
  1735.     moveq    #0,d0
  1736.     move.b    bmh_Depth(a0),d0
  1737.     move.w    d0,iffdepth
  1738.     move.w    bmh_XAspect(a0),aspects
  1739.     move.w    bmh_PageWidth(a0),pagewid
  1740.     move.w    bmh_PageHeight(a0),pageht
  1741.     
  1742.     moveq    #0,d0
  1743.     move.w    iffwidth,d0
  1744.     add.w    #15,d0
  1745.     divu    #16,d0
  1746.     add.w    d0,d0
  1747.     move.w    d0,bytewid1
  1748.     
  1749.     moveq    #0,d0
  1750.     move.w    iffwidth,d0
  1751.     move.w    d0,width
  1752.     add.w    #15,d0
  1753.     divu    #16,d0
  1754.     add.w    d0,d0
  1755.     move.w    d0,bytewid2
  1756.     
  1757.     move.w    bytewid2,d0
  1758.     move.w    iffheight,d1
  1759.     move.w    d1,height
  1760.     mulu    d1,d0
  1761.     moveq    #0,d1
  1762.     move.w    iffdepth,d1
  1763.     
  1764.     move.l    d2,-(sp)
  1765.     moveq    #0,d2
  1766. mulu8    add.l    d0,d2
  1767.     sub.l    #1,d1
  1768.     bne.b    mulu8
  1769.     move.l    d2,d0
  1770.     move.l    (sp)+,d2
  1771.     ;mulu.l    d1,d0    68000 cannot do this
  1772.     
  1773.     move.l    plsize,oldplsize
  1774.     move.l    d0,plsize
  1775.     
  1776.  
  1777.     move.l    colortable,a0
  1778.     lea    pal32,a1
  1779.     lea    palstore1,a2
  1780.  
  1781.     move.l    #1,d0
  1782.     move.w    iffdepth,d1
  1783.     lsl.l    d1,d0
  1784.     move.w    d0,(a1)+
  1785.     clr.w    (a1)+
  1786.     mulu    #3,d0
  1787.     
  1788. copypal3    move.l    (a0),d1
  1789.     rol.l    #8,d1
  1790.     move.b    d1,(a2)+
  1791.     move.l    (a0)+,(a1)+
  1792.     sub.w    #1,d0
  1793.     bne.b    copypal3
  1794.  
  1795.     move.l    intuibase,a6
  1796.     move.l    winpt1,a0
  1797.     jsr    _LVOClearMenuStrip(a6)
  1798.     
  1799.     move.l    winpt1,a0
  1800.     jsr    _LVOCloseWindow(a6)
  1801.     clr.l    winpt1
  1802.     
  1803.     move.l    scrpt1,a0
  1804.     jsr    _LVOCloseScreen(a6)
  1805.     clr.l    scrpt1
  1806.     
  1807.     tst.l    pladdr
  1808.     beq.b    nobplns2
  1809.     
  1810.     move.l    pladdr,a1
  1811.     move.l    oldplsize,d0
  1812.     move.l    4.w,a6
  1813.     jsr    _LVOFreeMem(a6)
  1814.     clr.l    pladdr
  1815.     
  1816. nobplns2    move.w    bytewid2,bytesperrow
  1817.     move.w    height,height2
  1818.     move.w    iffdepth,d0
  1819.     move.b    d0,scdepth
  1820.  
  1821.     move.l    plsize,d0
  1822.     move.l    #MEMF_CHIP|MEMF_CLEAR,d1
  1823.     move.l    4.w,a6
  1824.     jsr    _LVOAllocMem(a6)
  1825.     tst.l    d0
  1826.     beq.w    noplram
  1827.     move.l    d0,pladdr
  1828.  
  1829.     move.w    iffdepth,d2
  1830.     move.w    bytewid2,d1
  1831.     mulu    height,d1
  1832.     move.l    pladdr,d0
  1833.     lea    bplptr,a1
  1834.     
  1835. modibpl2    move.l    d0,(a1)+
  1836.     add.l    d1,d0
  1837.     sub.w    #1,d2
  1838.     bne.b    modibpl2
  1839.  
  1840.     move.w    pagewid,scrwid
  1841.     move.w    pagewid,winwidth
  1842.     move.w    pageht,scrht
  1843.     move.w    pageht,winheight
  1844.     sub.w    #22,winheight
  1845.  
  1846.     move.w    iffdepth,scrdepth
  1847.     move.l    iffcamg,d0
  1848.  
  1849.     and.l    #camgmask,d0
  1850.     move.l    d0,scrvmodes
  1851.     
  1852.     move.l    intuibase,a6
  1853.     lea    newscreen,a0
  1854.     jsr    _LVOOpenScreen(a6)
  1855.     tst.l    d0
  1856.     beq.w    noram
  1857.     move.l    d0,scrpt1
  1858.     move.l    d0,scrpt2
  1859.     move.l    d0,scrpt3
  1860.     move.l    d0,scrpt4
  1861.     ;move.l    d0,scrpt5
  1862.     
  1863.     move.w    iffdepth,cdepth
  1864.     move.w    cdepth,d0
  1865.     move.w    #1,d1
  1866.     lea    depthASCII,a0
  1867.     bsr.w    numtohexasc
  1868.     
  1869.     lea    newwindow,a0
  1870.     move.l    intuibase,a6
  1871.     jsr    _LVOOpenWindow(a6)
  1872.     move.l    d0,winpt1
  1873.     move.l    d0,winpt2
  1874.     move.l    d0,winpt3
  1875.     move.l    d0,winpt4
  1876.     beq.w    noram
  1877.     
  1878.     move.l    winpt1,a0
  1879.     lea    menu1,a1
  1880.     move.l    intuibase,a6
  1881.     jsr    _LVOSetMenuStrip(a6)
  1882.     
  1883.     move.l    winpt1,a0
  1884.     lea    mousept,a1
  1885.     move.w    #15,d0
  1886.     move.w    #15,d1
  1887.     move.w    #-8,d2
  1888.     move.w    #-7,d3
  1889.     jsr    _LVOSetPointer(a6)
  1890.     
  1891.     move.l    winpt1,a1
  1892.     move.l    wd_RPort(a1),a1
  1893.     move.b    #RP_COMPLEMENT,d0
  1894.     move.l    gfxbase,a6
  1895.     jsr    _LVOSetDrMd(a6)
  1896.     
  1897.     move.w    #$FFFF,brtlx
  1898.     move.w    #$FFFF,brtly
  1899.     move.w    #$FFFF,brbrx
  1900.     move.w    #$FFFF,brbry
  1901.     sf    brushon
  1902.     bsr.w    updatecoords
  1903.     bsr.w    fakebpl
  1904.  
  1905.     move.l    dtbase,a6
  1906.     move.l    dtobject,a0
  1907.     sub.l    a1,a1
  1908.     sub.l    a2,a2
  1909.     lea    dtattrs2,a3
  1910.     jsr    _LVOSetDTAttrsA(a6)
  1911.  
  1912.     move.l    winpt1,a0
  1913.     sub.l    a1,a1
  1914.     move.l    dtobject,a2
  1915.     move.l    #-1,d0
  1916.     jsr    _LVOAddDTObject(a6)
  1917.     
  1918. debug     move.l    dtobject,a0
  1919.     lea    dtattrs,a2
  1920.     jsr    _LVOGetDTAttrsA(a6)
  1921.     
  1922.     tst.l    bitmapaddr
  1923.     beq.b    debug
  1924.     
  1925.     move.l    bitmapaddr,a0
  1926.     move.l    #bitmap,a1
  1927.     moveq    #0,d0
  1928.     moveq    #0,d1
  1929.     moveq    #0,d2
  1930.     moveq    #0,d3
  1931.     move.w    iffwidth,d4
  1932.     move.w    iffheight,d5
  1933.     move.l    #$c0,d6
  1934.     move.l    #-1,d7
  1935.     move.l    gfxbase,a6
  1936.     jsr    _LVOBltBitMap(a6)
  1937.  
  1938.     move.l    dtbase,a6    
  1939.     move.l    dtobject,a0
  1940.     move.l    winpt1,a1
  1941.     sub.l    a2,a2
  1942.     sub.l    a3,a3
  1943.     jsr    _LVORefreshDTObjectA(a6)
  1944.  
  1945.     move.l    winpt1,a0
  1946.     move.l    dtobject,a1
  1947.     jsr    _LVORemoveDTObject(a6)
  1948.     
  1949.     move.l    dtobject,a0
  1950.     jsr    _LVODisposeDTObject(a6)
  1951.     bsr    closefile
  1952.     bra    nomessage1
  1953.  
  1954. unknowntype    ;lea    menupal,a1
  1955.     ;move.l    scrpt1,a0
  1956.     ;lea    sc_ViewPort(a0),a0
  1957.     ;move.l    #4,d0
  1958.     ;move.l    gfxbase,a6
  1959.     ;jsr    _LVOLoadRGB4(a6)
  1960.     
  1961.     ;lea    rawloadwin,a0
  1962.     ;move.l    intuibase,a6
  1963.     ;jsr    _LVOOpenWindow(a6)
  1964.     ;move.l    d0,winpt1
  1965.     
  1966.     bsr    closefile
  1967.     lea    bodyfmt3,a1
  1968.     lea    gadfmt3,a2
  1969.     lea    taglist,a0
  1970.     lea    0,a3
  1971.     lea    0,a4
  1972.     move.l    reqtbase,a6
  1973.     jsr    _LVOrtEZRequestA(a6)
  1974.     bra    nomessage1
  1975.  
  1976. closefile    tst.l    handle1
  1977.     beq    nofileopen
  1978.     
  1979.     move.l    dosbase,a6
  1980.     move.l    handle1,d1
  1981.     jsr    _LVOClose(a6)
  1982.     clr.l    handle1
  1983.     
  1984. nofileopen    tst.l    olddirlock
  1985.     beq    noolddir
  1986.     
  1987.     move.l    dosbase,a6
  1988.     move.l    olddirlock,d1
  1989.     jsr    _LVOCurrentDir(a6)
  1990.     
  1991. noolddir    tst.l    filelock
  1992.     beq    nofilelock
  1993.     
  1994.     move.l    filelock,d1
  1995.     move.l    dosbase,a6
  1996.     jsr    _LVOUnLock(a6)
  1997.     clr.l    filelock
  1998. nofilelock    rts
  1999.  
  2000. savepic    clr.b    filename
  2001.     tst.l    pladdr
  2002.     beq    nomessage1
  2003.     
  2004.     ;move.l    scrpt1,a0
  2005.     ;sub.l    a1,a1
  2006.     ;move.l    gadbase,a6
  2007.     ;jsr    _LVOGetVisualInfoA(a6)
  2008.     ;move.l    d0,visinfo
  2009.     ;beq    novisinfo
  2010.     ;move.l    d0,visinfo2
  2011.     
  2012.     ;move.l    gadbase,a6
  2013.     ;lea    gads,a0
  2014.     ;jsr    _LVOCreateContext(a6)
  2015.     ;tst.l    d0
  2016.     ;beq    nocontext
  2017.     ;move.l    d0,a0
  2018.     
  2019.     ;move.l    #MX_KIND,d0
  2020.     ;lea    picsavegad1,a1
  2021.     ;lea    gadtags1,a2
  2022.     ;jsr    _LVOCreateGadgetA(a6)
  2023.     ;move.l    d0,gadtgad1
  2024.     ;beq    nogadtgad
  2025.  
  2026.     ;move.w    pageht,d0
  2027.     ;sub.w    #200,d0
  2028.     ;lsr.w    #1,d0
  2029.     ;move.w    d0,spwiny
  2030.     ;move.w    pagewid,d0
  2031.     ;sub.w    #200,d0
  2032.     ;lsr.w    #1,d0
  2033.     ;move.w    d0,spwinx
  2034.  
  2035.     ;move.l    gads,spwingads
  2036.     
  2037.     ;lea    saveprefswin,a0
  2038.     ;move.l    intuibase,a6
  2039.     ;jsr    _LVOOpenWindow(a6)
  2040.     ;move.l    d0,tempwinptr
  2041.     
  2042.     ;move.l    tempwinptr,a0
  2043.     ;sub.l    a1,a1
  2044.     ;move.l    gadbase,a6
  2045.     ;jsr    _LVOGT_RefreshWindow(a6)
  2046.  
  2047.     ;move.l    intuibase,a6
  2048.     ;move.l    tempwinptr,a0
  2049.     ;jsr    _LVOCloseWindow(a6)
  2050.  
  2051. nogadtgad
  2052. nocontext    ;move.l    visinfo,a0
  2053.     ;move.l    gadbase,a6
  2054.     ;jsr    _LVOFreeVisualInfo(a6)
  2055.  
  2056. novisinfo    tst.b    d0
  2057.     bne    iffsave
  2058.         
  2059.     move.l    req2,a1
  2060.     lea    filename,a2
  2061.     lea    savetxt,a3
  2062.     lea    tags2,a0
  2063.     move.l    reqtbase,a6
  2064.     jsr    _LVOrtFileRequestA(a6)
  2065.     tst.l    d0
  2066.     beq    nomessage1
  2067.     
  2068.     lea    menupal,a1
  2069.     move.l    scrpt1,a0
  2070.     lea    sc_ViewPort(a0),a0
  2071.     move.l    #4,d0
  2072.     move.l    gfxbase,a6
  2073.     jsr    _LVOLoadRGB4(a6)
  2074.  
  2075.     move.l    #srawtitle,windowtitle
  2076.     
  2077.     lea    newloadwin,a0
  2078.     move.l    intuibase,a6
  2079.     jsr    _LVOOpenWindow(a6)
  2080.     move.l    d0,lswindow
  2081.     bsr    drawLSwin
  2082.     
  2083.     move.l    req2,a1
  2084.     move.l    rtfi_Dir(a1),d1
  2085.     move.l    #SHARED_LOCK,d2
  2086.     move.l    dosbase,a6
  2087.     jsr    _LVOLock(a6)
  2088.     move.l    d0,filelock
  2089.     beq    writeerr
  2090.     
  2091.     move.l    d0,d1
  2092.     jsr    _LVOCurrentDir(a6)
  2093.     move.l    d0,olddirlock
  2094.     
  2095.     move.l    #filename,d1
  2096.     move.l    #MODE_NEWFILE,d2
  2097.     move.l    dosbase,a6
  2098.     jsr    _LVOOpen(a6)
  2099.     tst.l    d0
  2100.     beq    writeerr
  2101.     
  2102.     move.l    d0,handle1
  2103.     cmp.b    #2,palinfo
  2104.     bne    nopalbefore1
  2105.     
  2106.     bsr    savepalbin
  2107.     bne    writeerr
  2108.  
  2109. nopalbefore1
  2110.     move.l    pladdr,a0
  2111.     cmp.b    #1,bplmeth
  2112.     beq    savebinil
  2113.     
  2114.     move.w    iffheight,d1
  2115.     mulu    cdepth,d1
  2116.     move.w    d1,maxline
  2117. nextline3    move.w    d1,lineno
  2118.     bsr    updateLSwin
  2119.  
  2120.     cmp.b    #1,extrablit
  2121.     bne    noblitL1
  2122.     
  2123.     clr.w    store1
  2124.     filewrite    handle1,#store1,#2
  2125.     
  2126. noblitL1    moveq    #0,d0
  2127.     move.w    bytewid1,d0
  2128.     
  2129.     filewrite    handle1,a0,d0
  2130.     
  2131.     cmp.b    #2,extrablit
  2132.     bne    noblitR1
  2133.     
  2134.     clr.w    store1
  2135.     filewrite    handle1,#store1,#2
  2136.     
  2137. noblitR1    moveq    #0,d0
  2138.     move.w    bytewid1,d0
  2139.     lea    0(a0,d0.w),a0
  2140.     
  2141.     sub.l    #1,d1
  2142.     bne    nextline3
  2143.     
  2144.     cmp.b    #1,palinfo
  2145.     bne    nopalafter1
  2146.     
  2147.     bsr    savepalbin
  2148.     bne    writeerr
  2149.     
  2150. nopalafter1    bsr    closeLSwin
  2151.     bsr    closefile
  2152.     bra    nomessage1
  2153.  
  2154. savebinil    moveq    #0,d1
  2155.     move.w    iffheight,d1
  2156. nextline4    move.w    d1,lineno
  2157.     move.w    iffheight,maxline
  2158.     bsr    updateLSwin
  2159.  
  2160.     move.w    #1,d2
  2161. nextpl1    cmp.w    cdepth,d2
  2162.     bgt    noplwrite
  2163.     
  2164.     cmp.b    #1,extrablit
  2165.     bne    noblitL2
  2166.     
  2167.     clr.w    store1
  2168.     filewrite    handle1,#store1,#2
  2169.     
  2170. noblitL2    moveq    #0,d0
  2171.     move.w    bytewid1,d0
  2172.     
  2173.     filewrite    handle1,a0,d0
  2174.     
  2175.     cmp.b    #2,extrablit
  2176.     bne    noblitR2
  2177.     
  2178.     clr.w    store1
  2179.     filewrite    handle1,#store1,#2
  2180.  
  2181. noplwrite
  2182. noblitR2    move.w    bytewid1,d0
  2183.     mulu    iffheight,d0
  2184.     
  2185.     lea    0(a0,d0.l),a0
  2186.     add.w    #1,d2
  2187.     cmp.w    iffdepth,d2
  2188.     ble    nextpl1
  2189.     
  2190.     move.w    bytewid1,d0
  2191.     mulu    iffheight,d0
  2192.     
  2193.     move.l    d1,-(sp)
  2194.     moveq    #0,d1
  2195.     move.w    iffdepth,d1
  2196.     move.l    d2,-(sp)
  2197.     moveq    #0,d2
  2198. mulu4    add.l    d0,d2
  2199.     sub.l    #1,d1
  2200.     bne    mulu4
  2201.     move.l    d2,d0
  2202.     move.l    (sp)+,d2
  2203.     ;mulu.l    d1,d0    68000 cannot do this
  2204.     
  2205.     move.l    (sp)+,d1
  2206.     
  2207.     sub.l    d0,a0
  2208.     move.w    bytewid1,d0
  2209.     
  2210.     lea    0(a0,d0.w),a0
  2211.     
  2212.     sub.l    #1,d1
  2213.     bne    nextline4
  2214.     
  2215.     cmp.b    #1,palinfo
  2216.     bne    nopalafter2
  2217.     
  2218.     bsr    savepalbin
  2219.     bne    writeerr
  2220.     
  2221. nopalafter2    bsr    closeLSwin
  2222.     bsr    closefile
  2223.     bsr    fakebpl
  2224.     bra    nomessage1
  2225.  
  2226. iffsave    move.l    req2,a1
  2227.     lea    filename,a2
  2228.     lea    savetxt,a3
  2229.     lea    tags2,a0
  2230.     move.l    reqtbase,a6
  2231.     jsr    _LVOrtFileRequestA(a6)
  2232.     tst.l    d0
  2233.     beq    nomessage1
  2234.     
  2235.     lea    menupal,a1
  2236.     move.l    scrpt1,a0
  2237.     lea    sc_ViewPort(a0),a0
  2238.     move.l    #4,d0
  2239.     move.l    gfxbase,a6
  2240.     jsr    _LVOLoadRGB4(a6)
  2241.     
  2242.     move.l    #swintitle,windowtitle
  2243.     lea    newloadwin,a0
  2244.     move.l    intuibase,a6
  2245.     jsr    _LVOOpenWindow(a6)
  2246.     move.l    d0,lswindow
  2247.     bsr    drawLSwin
  2248.     
  2249.     move.l    req2,a1
  2250.     move.l    rtfi_Dir(a1),d1
  2251.     move.l    #SHARED_LOCK,d2
  2252.     move.l    dosbase,a6
  2253.     jsr    _LVOLock(a6)
  2254.     move.l    d0,filelock
  2255.     beq    writeerr
  2256.     
  2257.     move.l    d0,d1
  2258.     jsr    _LVOCurrentDir(a6)
  2259.     move.l    d0,olddirlock
  2260.     
  2261.     move.l    #filename,d1
  2262.     move.l    #MODE_NEWFILE,d2
  2263.     move.l    dosbase,a6
  2264.     jsr    _LVOOpen(a6)
  2265.     tst.l    d0
  2266.     beq    writeerr
  2267.     move.l    d0,handle1
  2268.     
  2269.     move.l    #'FORM',store1
  2270.     filewrite    handle1,#store1,#4
  2271.     
  2272.     clr.l    store1
  2273.     filewrite    handle1,#store1,#4
  2274.  
  2275.     moveq    #0,d5
  2276.     move.l    #'ILBM',store1
  2277.     filewrite    handle1,#store1,#4
  2278.     add.l    #4,d5
  2279.     
  2280.     move.l    #'BMHD',store1
  2281.     filewrite    handle1,#store1,#4
  2282.     add.l    #4,d5
  2283.     
  2284.     move.l    #20,store1
  2285.     filewrite    handle1,#store1,#4
  2286.     add.l    #4,d5
  2287.     
  2288.     move.w    iffwidth,store1
  2289.     filewrite    handle1,#store1,#2
  2290.     add.l    #2,d5
  2291.     
  2292.     move.w    iffheight,store1
  2293.     filewrite    handle1,#store1,#2
  2294.     add.l    #2,d5
  2295.     
  2296.     clr.l    store1
  2297.     filewrite    handle1,#store1,#4
  2298.     add.l    #4,d5
  2299.     
  2300.     move.w    cdepth,d0
  2301.     move.b    d0,store1
  2302.     filewrite    handle1,#store1,#1
  2303.     add.l    #1,d5
  2304.     
  2305.     clr.b    store1
  2306.     filewrite    handle1,#store1,#1
  2307.     add.l    #1,d5
  2308.     
  2309.     move.b    iffcomp,store1
  2310.     filewrite    handle1,#store1,#1
  2311.     add.l    #1,d5
  2312.     
  2313.     clr.b    store1
  2314.     filewrite    handle1,#store1,#1
  2315.     add.l    #1,d5
  2316.     
  2317.     clr.w    store1
  2318.     filewrite    handle1,#store1,#2
  2319.     add.l    #2,d5
  2320.     
  2321.     filewrite    handle1,#aspects,#2
  2322.     add.l    #2,d5
  2323.     
  2324.     move.w    pagewid,store1
  2325.     filewrite    handle1,#store1,#2
  2326.     add.l    #2,d5
  2327.     
  2328.     move.w    pageht,store1
  2329.     filewrite    handle1,#store1,#2
  2330.     add.l    #2,d5
  2331.     
  2332.     move.l    #'CMAP',store1
  2333.     filewrite    handle1,#store1,#4
  2334.     add.l    #4,d5
  2335.     
  2336.     move.w    #1,d0
  2337.     move.w    cdepth,d1
  2338.     lsl.w    d1,d0
  2339.     mulu    #3,d0
  2340.     move.l    d0,d6
  2341.     move.l    d0,store1
  2342.     
  2343.     filewrite    handle1,#store1,#4
  2344.     add.l    #4,d5
  2345.     
  2346.     lea    palstore1,a0
  2347. writepal    move.b    (a0)+,store1
  2348.     move.b    (a0)+,store1+1
  2349.     move.b    (a0)+,store1+2
  2350.     
  2351.     filewrite    handle1,#store1,#3
  2352.     add.l    #3,d5
  2353.     
  2354.     sub.l    #3,d6
  2355.     bne    writepal
  2356.     
  2357.     btst    #0,d5
  2358.     beq    nopad1
  2359.     
  2360.     clr.b    store1
  2361.     filewrite    handle1,#store1,#1
  2362.     add.l    #1,d5
  2363.     
  2364. nopad1    move.l    #'CAMG',store1
  2365.     filewrite    handle1,#store1,#4
  2366.     add.l    #4,d5
  2367.     
  2368.     move.l    #4,store1
  2369.     filewrite    handle1,#store1,#4
  2370.     add.l    #4,d5
  2371.     
  2372.     move.l    iffcamg,store1
  2373.     and.l    #camgmask,store1
  2374.     filewrite    handle1,#store1,#4
  2375.     add.l    #4,d5
  2376.     
  2377.     move.l    #'BODY',store1
  2378.     filewrite    handle1,#store1,#4
  2379.     add.l    #4,d5
  2380.     move.l    d5,blenpos
  2381.     
  2382.     move.w    bytewid1,d0
  2383.     mulu    iffheight,d0
  2384.     
  2385.     move.l    d1,-(sp)
  2386.     moveq    #0,d1
  2387.     move.w    cdepth,d1
  2388.     move.l    d2,-(sp)
  2389.     moveq    #0,d2
  2390. mulu5    add.l    d0,d2
  2391.     sub.l    #1,d1
  2392.     bne    mulu5
  2393.     move.l    d2,d0
  2394.     move.l    (sp)+,d2
  2395.     ;mulu.l    d1,d0    68000 cannot do this
  2396.     
  2397.     move.l    (sp)+,d1
  2398.     
  2399.     move.l    d0,store1
  2400.     filewrite    handle1,#store1,#4
  2401.     add.l    #4,d5
  2402.     
  2403.     move.l    pladdr,a0
  2404.     moveq    #0,d1
  2405.     move.w    iffheight,d1
  2406. nextline5    move.w    d1,lineno
  2407.     move.w    iffheight,maxline
  2408.     bsr    updateLSwin
  2409.  
  2410.     move.w    #1,d2
  2411. nextplane3    cmp.w    cdepth,d2
  2412.     bgt    planesdone
  2413.     
  2414.     tst.b    iffcomp
  2415.     beq    nocomp1
  2416.     
  2417.     move.l     a0,buffptr2
  2418.     move.l     #copybuff,buffptr1
  2419.     
  2420.     movem.l    d0-d7/a0-a6,-(sp)
  2421.     moveq    #0,d0
  2422.     move.w    bytewid1,d0
  2423.     move.l    d0,-(sp)    ;store length
  2424.     move.l    #buffptr1,-(sp);store dest
  2425.     move.l    #buffptr2,-(sp);store source
  2426.     bsr    packrow      
  2427.     move.l    d0,store1
  2428.     
  2429.     lea    12(sp),sp
  2430.     movem.l    (sp)+,d0-d7/a0-a6
  2431.     add.l    store1,d5
  2432.     filewrite    handle1,#copybuff,store1
  2433.     bra    planesdone
  2434.  
  2435.  
  2436. nocomp1    moveq    #0,d0
  2437.     move.w    bytewid1,d0
  2438.     filewrite    handle1,a0,d0
  2439.     add.l    d0,d5
  2440.     
  2441. planesdone    move.w    bytewid1,d0
  2442.     mulu    iffheight,d0
  2443.     
  2444.     lea    0(a0,d0.l),a0
  2445.     add.w    #1,d2
  2446.     
  2447.     cmp.w    iffdepth,d2
  2448.     ble    nextplane3
  2449.     
  2450.     move.w    bytewid1,d0
  2451.     mulu    iffheight,d0
  2452.     
  2453.     move.l    d1,-(sp)
  2454.     moveq    #0,d1
  2455.     move.w    iffdepth,d1
  2456.     move.l    d2,-(sp)
  2457.     moveq    #0,d2
  2458. mulu6    add.l    d0,d2
  2459.     sub.l    #1,d1
  2460.     bne    mulu6
  2461.     move.l    d2,d0
  2462.     move.l    (sp)+,d2
  2463.     ;mulu.l    d1,d0    68000 cannot do this
  2464.     
  2465.     move.l    (sp)+,d1
  2466.     
  2467.     sub.l    d0,a0
  2468.     
  2469.     move.w    bytewid1,d0
  2470.     lea    0(a0,d0.w),a0
  2471.     
  2472.     sub.l    #1,d1
  2473.     bne    nextline5
  2474.     
  2475.     filemove    handle1,#4
  2476.     
  2477.     move.l    d5,store1
  2478.     filewrite    handle1,#store1,#4
  2479.     
  2480.     tst.b    iffcomp
  2481.     beq    nocomp2
  2482.     
  2483.     filemove    handle1,blenpos
  2484.     fileskip    handle1,#8
  2485.     
  2486.     sub.l    blenpos,d5
  2487.     sub.l    #4,d5
  2488.     move.l    d5,store1
  2489.     filewrite    handle1,#store1,#4
  2490.  
  2491. nocomp2    bsr    closeLSwin
  2492.     bsr    closefile
  2493.     bsr    fakebpl
  2494.     bra    nomessage1
  2495.  
  2496. savebr    tst.b    d0
  2497.     beq    brrawsave
  2498.     tst.w    brtlx
  2499.     bge    brushset1
  2500.     tst.w    brbrx
  2501.     bge    brushset1
  2502.     tst.w    brtly
  2503.     bge    brushset1
  2504.     tst.w    brbry
  2505.     bge    brushset1
  2506.     bra    nomessage1
  2507.  
  2508. brushset1    move.w    brtlx,d0
  2509.     move.w    brbrx,d1
  2510.     cmp.w    d0,d1
  2511.     bge    noswap3
  2512.     
  2513.     exg    d0,d1
  2514.     
  2515. noswap3    move.w    d0,brtlx
  2516.     move.w    d1,brbrx
  2517.     move.w    brtly,d0
  2518.     move.w    brbry,d1
  2519.     cmp.w    d0,d1
  2520.     bge    noswap4
  2521.     
  2522.     exg    d0,d1
  2523.     
  2524. noswap4    move.w    d0,brtly
  2525.     move.w    d1,brbry
  2526.     move.w    brtlx,d0
  2527.     move.w    brbrx,d1
  2528.     sub.w    d1,d0
  2529.     
  2530.     clr.b    filename
  2531.     move.l    req2,a1
  2532.     lea    filename,a2
  2533.     lea    savetxt,a3
  2534.     lea    tags2,a0
  2535.     move.l    reqtbase,a6
  2536.     jsr    _LVOrtFileRequestA(a6)
  2537.     tst.l    d0
  2538.     beq    nomessage1
  2539.     
  2540.     lea    menupal,a1
  2541.     move.l    scrpt1,a0
  2542.     lea    sc_ViewPort(a0),a0
  2543.     move.l    #4,d0
  2544.     move.l    gfxbase,a6
  2545.     jsr    _LVOLoadRGB4(a6)
  2546.  
  2547.     move.l    #swintitle,windowtitle
  2548.     lea    newloadwin,a0
  2549.     move.l    intuibase,a6
  2550.     jsr    _LVOOpenWindow(a6)
  2551.     move.l    d0,lswindow
  2552.     
  2553.     bsr    drawLSwin
  2554.  
  2555.     move.l    req2,a1
  2556.     move.l    rtfi_Dir(a1),d1
  2557.     move.l    #SHARED_LOCK,d2
  2558.     move.l    dosbase,a6
  2559.     jsr    _LVOLock(a6)
  2560.     move.l    d0,filelock
  2561.     beq    writeerr
  2562.     
  2563.     move.l    d0,d1
  2564.     jsr    _LVOCurrentDir(a6)
  2565.     move.l    d0,olddirlock
  2566.     
  2567.     move.l    #filename,d1
  2568.     move.l    #MODE_NEWFILE,d2
  2569.     move.l    dosbase,a6
  2570.     jsr    _LVOOpen(a6)
  2571.     tst.l    d0
  2572.     beq    writeerr
  2573.     move.l    d0,handle1
  2574.     
  2575.     move.l    #'FORM',store1
  2576.     filewrite    handle1,#store1,#4
  2577.     
  2578.     clr.l    store1
  2579.     filewrite    handle1,#store1,#4
  2580.     
  2581.     moveq    #0,d4
  2582.     move.l    #'ILBM',store1
  2583.     filewrite    handle1,#store1,#4
  2584.     add.l    #4,d4
  2585.     
  2586.     move.l    #'BMHD',store1
  2587.     filewrite    handle1,#store1,#4
  2588.     add.l    #4,d4
  2589.     
  2590.     move.l    #20,store1
  2591.     filewrite    handle1,#store1,#4
  2592.     add.l    #4,d4
  2593.     
  2594.     move.w    brbrx,d0
  2595.     sub.w    brtlx,d0
  2596.     tst.b    extrablit
  2597.     beq    noxblit
  2598.     add.w    #16,d0
  2599. noxblit    add.w    #1,d0
  2600.     
  2601.     move.w    d0,store1
  2602.     filewrite    handle1,#store1,#2
  2603.     add.l    #2,d4
  2604.     
  2605.     move.w    brbry,d0
  2606.     sub.w    brtly,d0
  2607.     add.w    #1,d0
  2608.     move.w    d0,store1
  2609.     filewrite    handle1,#store1,#2
  2610.     add.l    #2,d4
  2611.     
  2612.     clr.l    store1
  2613.     filewrite    handle1,#store1,#4
  2614.     add.l    #4,d4
  2615.     
  2616.     move.w    cdepth,d0
  2617.     move.b    d0,store1
  2618.     filewrite    handle1,#store1,#1
  2619.     add.l    #1,d4
  2620.     
  2621.     clr.b    store1
  2622.     filewrite    handle1,#store1,#1
  2623.     add.l    #1,d4
  2624.     
  2625.     move.b    iffcomp,store1
  2626.     filewrite    handle1,#store1,#1
  2627.     add.l    #1,d4
  2628.     
  2629.     clr.b    store1
  2630.     filewrite    handle1,#store1,#1
  2631.     add.l    #1,d4
  2632.     
  2633.     clr.w    store1
  2634.     filewrite    handle1,#store1,#2
  2635.     add.l    #2,d4
  2636.     
  2637.     filewrite    handle1,#aspects,#2
  2638.     add.l    #2,d4
  2639.     
  2640.     move.w    pagewid,store1
  2641.     filewrite    handle1,#store1,#2
  2642.     add.l    #2,d4
  2643.     
  2644.     move.w    pageht,store1
  2645.     filewrite    handle1,#store1,#2
  2646.     add.l    #2,d4
  2647.     
  2648.     move.l    #'CMAP',store1
  2649.     filewrite    handle1,#store1,#4
  2650.     add.l    #4,d4
  2651.     
  2652.     move.w    #1,d0
  2653.     move.w    cdepth,d1
  2654.     lsl.w    d1,d0
  2655.     mulu    #3,d0
  2656.     move.l    d0,d6
  2657.     move.l    d0,store1
  2658.     filewrite    handle1,#store1,#4
  2659.     add.l    #4,d4
  2660.     
  2661.     lea    palstore1,a0
  2662.     
  2663. savepal1    move.b    (a0)+,store1
  2664.     move.b    (a0)+,store1+1
  2665.     move.b    (a0)+,store1+2
  2666.     filewrite    handle1,#store1,#3
  2667.     add.l    #3,d4
  2668.     sub.l    #3,d6
  2669.     bne    savepal1
  2670.     
  2671.     btst    #0,d4
  2672.     beq    nopad5
  2673.     clr.b    store1
  2674.     filewrite    handle1,#store1,#1
  2675.     add.l    #1,d4
  2676.     
  2677. nopad5    move.l    #'CAMG',store1
  2678.     filewrite    handle1,#store1,#4
  2679.     add.l    #4,d4
  2680.     
  2681.     move.l    #4,store1
  2682.     filewrite    handle1,#store1,#4
  2683.     add.l    #4,d4
  2684.     
  2685.     move.l    iffcamg,store1
  2686.     and.l    #camgmask,store1
  2687.     filewrite    handle1,#store1,#4
  2688.     add.l    #4,d4
  2689.     
  2690.     move.l    #'BODY',store1
  2691.     filewrite    handle1,#store1,#4
  2692.     add.l    #4,d4
  2693.     move.l    d4,blenpos
  2694.     
  2695.     move.w    brbrx,d0
  2696.     sub.w    brtlx,d0
  2697.     add.w    #1,d0
  2698.     add.w    #15,d0
  2699.     divu    #16,d0
  2700.     
  2701.     add.w    d0,d0
  2702.     
  2703.     move.w    brbry,d1
  2704.     sub.w    brtly,d1
  2705.     add.w    #1,d1
  2706.     mulu    d1,d0
  2707.     
  2708.     move.l    d1,-(sp)
  2709.     moveq    #0,d1
  2710.     move.w    cdepth,d1
  2711.     move.l    d2,-(sp)
  2712.     moveq    #0,d2
  2713. mulu7    add.l    d0,d2
  2714.     sub.l    #1,d1
  2715.     bne    mulu7
  2716.     move.l    d2,d0
  2717.     move.l    (sp)+,d2
  2718.     ;mulu.l    d1,d0    68000 cannot do this
  2719.     
  2720.     move.l    (sp)+,d1
  2721.     
  2722.     move.l    d0,store1
  2723.     filewrite    handle1,#store1,#4
  2724.     add.l    #4,d4
  2725.     
  2726.     move.l    pladdr,a0
  2727.     lea    copybuff,a1
  2728.     move.w    brtly,d5
  2729.     move.l    a0,a4
  2730. nextline6    move.w    brbry,lineno
  2731.     sub.w    d5,lineno
  2732.     move.w    brbry,maxline
  2733.     
  2734.     move.w    brtly,d2
  2735.     sub.w    d2,maxline
  2736.     bsr    updateLSwin
  2737.  
  2738.     move.w    #1,d2
  2739.     move.w    d5,d3
  2740.     
  2741.     mulu    bytewid1,d3
  2742.     
  2743.     lea    0(a0,d3.l),a0
  2744.     
  2745. nextplane4    cmp.b    #1,extrablit
  2746.     bne    noblitL3
  2747.     
  2748.     clr.w    (a1)+
  2749.     
  2750. noblitL3    move.w    brtlx,d1
  2751. nextbyte    move.w    #7,d3
  2752.     clr.b    (a1)
  2753. nextbit    move.w    d1,d6
  2754.     move.w    d1,d7
  2755.     not.w    d7
  2756.     and.w    #7,d7
  2757.     and.w    #$FFF8,d6
  2758.     lsr.w    #3,d6
  2759.     
  2760.     btst    d7,0(a0,d6.w)
  2761.     beq    bitclear
  2762.     
  2763.     bset    d3,(a1)
  2764.     
  2765. bitclear    add.w    #1,d1
  2766.     cmp.w    brbrx,d1
  2767.     bgt    linedone
  2768.     
  2769.     sub.w    #1,d3
  2770.     bpl    nextbit
  2771.     
  2772.     add.w    #1,a1
  2773.     bra    nextbyte
  2774.  
  2775. linedone    add.w    #1,a1
  2776.     clr.b    (a1)
  2777.  
  2778.     cmp.b    #2,extrablit
  2779.     bne    noblitR3
  2780.     
  2781.     clr.w    (a1)+
  2782. noblitR3    
  2783.     cmp.w    cdepth,d2
  2784.     bgt    noplanes2
  2785.     
  2786.     sub.l    #copybuff,a1
  2787.     move.l    a1,d0
  2788.     add.l    #1,d0
  2789.     and.l    #$fffffffe,d0
  2790.     
  2791.     tst.b    iffcomp
  2792.     beq    nocomp3
  2793.     
  2794.     move.l    #copybuff,buffptr2
  2795.     move.l    #copybuff2,buffptr1
  2796.     
  2797.     movem.l    d0-d7/a0-a6,-(sp)
  2798.     move.l    d0,-(sp)    ;store length
  2799.     move.l    #buffptr1,-(sp);store dest
  2800.     move.l    #buffptr2,-(sp);store source
  2801.     bsr    packrow      
  2802.     move.l    d0,store1
  2803.     
  2804.     lea    12(sp),sp
  2805.     movem.l    (sp)+,d0-d7/a0-a6
  2806.     add.l    store1,d4
  2807.     filewrite    handle1,#copybuff2,store1
  2808.     bra    planesdone2
  2809.     
  2810. nocomp3    filewrite    handle1,#copybuff,d0
  2811.     add.l    a1,d4
  2812. noplanes2
  2813. planesdone2    lea    copybuff,a1
  2814.     move.w    iffheight,d0
  2815.     mulu    bytewid1,d0
  2816.     
  2817.     lea    0(a0,d0.l),a0
  2818.     
  2819.     add.w    #1,d2
  2820.     
  2821.     cmp.w    iffdepth,d2
  2822.     ble    nextplane4
  2823.     
  2824.     move.l    a4,a0
  2825.     add.w    #1,d5
  2826.     cmp.w    brbry,d5
  2827.     ble    nextline6
  2828.     
  2829.     filemove    handle1,#4
  2830.     
  2831.     move.l    d4,store1
  2832.     filewrite    handle1,#store1,#4
  2833.     
  2834.     tst.b    iffcomp
  2835.     beq    nocomp4
  2836.     
  2837.     filemove    handle1,blenpos
  2838.     fileskip    handle1,#8
  2839.     
  2840.     sub.l    blenpos,d4
  2841.     sub.l    #4,d4
  2842.     move.l    d4,store1
  2843.     filewrite    handle1,#store1,#4
  2844.  
  2845. nocomp4    bsr    closeLSwin
  2846.     bsr    closefile
  2847.     bsr    fakebpl
  2848.     bra    nomessage1
  2849.  
  2850. brrawsave    tst.w    brtlx
  2851.     bge    brushset2
  2852.     tst.w    brbrx
  2853.     bge    brushset2
  2854.     tst.w    brtly
  2855.     bge    brushset2
  2856.     tst.w    brbry
  2857.     bge    brushset2
  2858.     bra    nomessage1
  2859.  
  2860. brushset2    move.w    brtlx,d0
  2861.     move.w    brbrx,d1
  2862.     cmp.w    d0,d1
  2863.     bge    noswap5
  2864.     
  2865.     exg    d0,d1
  2866.     
  2867. noswap5    move.w    d0,brtlx
  2868.     move.w    d1,brbrx
  2869.     move.w    brtly,d0
  2870.     move.w    brbry,d1
  2871.     cmp.w    d0,d1
  2872.     bge    noswap6
  2873.     
  2874.     exg    d0,d1
  2875.     
  2876. noswap6    move.w    d0,brtly
  2877.     move.w    d1,brbry
  2878.     move.w    brtlx,d0
  2879.     move.w    brbrx,d1
  2880.     sub.w    d1,d0
  2881.     
  2882.     clr.b    filename
  2883.     move.l    req2,a1
  2884.     lea    filename,a2
  2885.     lea    savetxt,a3
  2886.     lea    tags2,a0
  2887.     move.l    reqtbase,a6
  2888.     jsr    _LVOrtFileRequestA(a6)
  2889.     tst.l    d0
  2890.     beq    nomessage1
  2891.     
  2892.     lea    menupal,a1
  2893.     move.l    scrpt1,a0
  2894.     lea    sc_ViewPort(a0),a0
  2895.     move.l    #4,d0
  2896.     move.l    gfxbase,a6
  2897.     jsr    _LVOLoadRGB4(a6)
  2898.  
  2899.     move.l    #srawtitle,windowtitle
  2900.     lea    newloadwin,a0
  2901.     move.l    intuibase,a6
  2902.     jsr    _LVOOpenWindow(a6)
  2903.     move.l    d0,lswindow
  2904.     bsr    drawLSwin
  2905.  
  2906.     move.l    req2,a1
  2907.     move.l    rtfi_Dir(a1),d1
  2908.     move.l    #SHARED_LOCK,d2
  2909.     move.l    dosbase,a6
  2910.     jsr    _LVOLock(a6)
  2911.     move.l    d0,filelock
  2912.     beq    writeerr
  2913.     
  2914.     move.l    d0,d1
  2915.     jsr    _LVOCurrentDir(a6)
  2916.     move.l    d0,olddirlock
  2917.     
  2918.     move.l    #filename,d1
  2919.     move.l    #MODE_NEWFILE,d2
  2920.     move.l    dosbase,a6
  2921.     jsr    _LVOOpen(a6)
  2922.     tst.l    d0
  2923.     beq    writeerr
  2924.     move.l    d0,handle1
  2925.     
  2926.     cmp.b    #2,palinfo
  2927.     bne    nopalbefore2
  2928.     
  2929.     bsr    savepalbin
  2930.     bne    writeerr
  2931.  
  2932. nopalbefore2
  2933.     tst.b    bplmeth
  2934.     bne    brsaverawil
  2935.     
  2936.     move.l    pladdr,a0
  2937.     lea    copybuff,a1
  2938.     move.w    #1,d2
  2939.     
  2940. nextplane5    move.l    a0,a4
  2941.     move.w    brtly,d5
  2942. nextline7    move.l    d7,-(sp)
  2943.     move.w    brbry,d7
  2944.     sub.w    brtly,d7
  2945.     mulu    iffdepth,d7
  2946.     move.w    d7,lineno
  2947.     
  2948.     move.w    brbry,d7
  2949.     sub.w    brtly,d7
  2950.     sub.w    #1,d2
  2951.     mulu    d2,d7
  2952.     add.w    #1,d2
  2953.     
  2954.     sub.w    brtly,d7
  2955.     add.w    d5,d7
  2956.     sub.w    d7,lineno
  2957.     move.l    (sp)+,d7
  2958.     
  2959.     move.w    brbry,maxline
  2960.     move.w    brtly,d1
  2961.     sub.w    d1,maxline
  2962.     move.w    maxline,d1
  2963.     mulu    iffdepth,d1
  2964.     move.w    d1,maxline
  2965.     bsr    updateLSwin
  2966.  
  2967.     move.w    brtlx,d1
  2968.     move.w    d5,d3
  2969.     
  2970.     mulu    bytewid1,d3
  2971.     lea    0(a0,d3.l),a0
  2972. nextbyte2    move.w    #7,d3
  2973.     clr.b    (a1)
  2974.     
  2975. nextbit2    move.w    d1,d6
  2976.     move.w    d1,d7
  2977.     not.w    d7
  2978.     and.w    #7,d7
  2979.     and.w    #$FFF8,d6
  2980.     lsr.w    #3,d6
  2981.     btst    d7,0(a0,d6.w)
  2982.     beq    bitclear2
  2983.     
  2984.     bset    d3,(a1)
  2985.     
  2986. bitclear2    add.w    #1,d1
  2987.     cmp.w    brbrx,d1
  2988.     bgt    linedone2
  2989.     
  2990.     sub.w    #1,d3
  2991.     bpl    nextbit2
  2992.     
  2993.     add.w    #1,a1
  2994.     bra    nextbyte2
  2995.  
  2996. linedone2    add.w    #1,a1
  2997.     cmp.w    cdepth,d2
  2998.     bgt    noplanes3
  2999.     
  3000.     cmp.b    #1,extrablit
  3001.     bne    noblitL4
  3002.     
  3003.     clr.w    store1
  3004.     filewrite    handle1,#store1,#2
  3005.     
  3006. noblitL4    clr.b    (a1)
  3007.     sub.l    #copybuff,a1
  3008.     move.l    a1,d0
  3009.     add.l    #1,d0
  3010.     and.l    #$fffffffe,d0
  3011.     filewrite    handle1,#copybuff,d0
  3012.     
  3013.     cmp.b    #2,extrablit
  3014.     bne    noblitR4
  3015.     
  3016.     clr.w    store1
  3017.     filewrite    handle1,#store1,#2
  3018.     
  3019. noplanes3
  3020. noblitR4    lea    copybuff,a1
  3021.     move.l    a4,a0
  3022.     add.w    #1,d5
  3023.     cmp.w    brbry,d5
  3024.     ble    nextline7
  3025.     
  3026.     move.l    a4,a0
  3027.     move.w    iffheight,d0
  3028.     mulu    bytewid1,d0
  3029.     
  3030.     lea    0(a0,d0.l),a0
  3031.     
  3032.     add.w    #1,d2
  3033.     cmp.w    iffdepth,d2
  3034.     ble    nextplane5
  3035.     
  3036.     cmp.b    #1,palinfo
  3037.     bne    nopalafter3
  3038.     
  3039.     bsr    savepalbin
  3040.     bne    writeerr
  3041.     
  3042. nopalafter3    bsr    closeLSwin
  3043.     bsr    closefile
  3044.     bsr    fakebpl
  3045.     bra    nomessage1
  3046.  
  3047. brsaverawil    move.l    pladdr,a0
  3048.     lea    copybuff,a1
  3049.     move.w    brtly,d5
  3050.     move.l    a0,a4
  3051.     
  3052. nextline8    move.w    brbry,lineno
  3053.     sub.w    d5,lineno
  3054.     move.w    brbry,maxline
  3055.     move.w    brtly,d2
  3056.     sub.w    d2,maxline
  3057.     bsr    updateLSwin
  3058.  
  3059.     move.w    #1,d2
  3060.     move.w    d5,d3
  3061.     mulu    bytewid1,d3
  3062.     lea    0(a0,d3.l),a0
  3063.     
  3064. nextplane6    move.w    brtlx,d1
  3065. nextbyte3    move.w    #7,d3
  3066.     clr.b    (a1)
  3067.     
  3068. nextbit3    move.w    d1,d6
  3069.     move.w    d1,d7
  3070.     not.w    d7
  3071.     and.w    #7,d7
  3072.     and.w    #$FFF8,d6
  3073.     lsr.w    #3,d6
  3074.     btst    d7,0(a0,d6.w)
  3075.     
  3076.     beq    bitclear3
  3077.     
  3078.     cmp.w    cdepth,d2
  3079.     bgt    noplanes4
  3080.     
  3081.     bset    d3,(a1)
  3082.     
  3083. noplanes4
  3084. bitclear3    add.w    #1,d1
  3085.     cmp.w    brbrx,d1
  3086.     bgt    linedone3
  3087.     
  3088.     sub.w    #1,d3
  3089.     bpl    nextbit3
  3090.     
  3091.     add.w    #1,a1
  3092.     bra    nextbyte3
  3093.  
  3094. linedone3    add.w    #1,a1
  3095.     cmp.b    #1,extrablit
  3096.     bne    noblitL5
  3097.     
  3098.     clr.w    store1
  3099.     filewrite    handle1,#store1,#2
  3100.     
  3101. noblitL5    clr.b    (a1)
  3102.     sub.l    #copybuff,a1
  3103.     move.l    a1,d0
  3104.     add.l    #1,d0
  3105.     and.l    #$fffffffe,d0
  3106.     filewrite    handle1,#copybuff,d0
  3107.     
  3108.     cmp.b    #2,extrablit
  3109.     bne    noblitR5
  3110.     
  3111.     clr.w    store1
  3112.     filewrite    handle1,#store1,#2
  3113.     
  3114. noblitR5    lea    copybuff,a1
  3115.     move.w    iffheight,d0
  3116.     mulu    bytewid1,d0
  3117.     
  3118.     lea    0(a0,d0.l),a0
  3119.     
  3120.     add.w    #1,d2
  3121.     
  3122.     cmp.w    cdepth,d2
  3123.     ble    nextplane6
  3124.     
  3125.     move.l    a4,a0
  3126.     add.w    #1,d5
  3127.     
  3128.     cmp.w    brbry,d5
  3129.     ble    nextline8
  3130.     
  3131.     cmp.b    #1,palinfo
  3132.     bne    nopalafter4
  3133.     
  3134.     bsr    savepalbin
  3135.     bne    writeerr
  3136.     
  3137. nopalafter4    bsr    closeLSwin
  3138.     bsr    closefile
  3139.     bsr    fakebpl
  3140.     bra    nomessage1
  3141.  
  3142. savesprite    cmp.b    #0,d0
  3143.     bne    notwid16
  3144.     
  3145.     move.l    #16,d1
  3146.     
  3147. notwid16    cmp.b    #1,d0
  3148.     bne    notwid32
  3149.     
  3150.     move.l    #32,d1
  3151.     
  3152. notwid32    cmp.b    #2,d0
  3153.     bne    notwid64
  3154.     
  3155.     move.l    #64,d1
  3156.     
  3157. notwid64    move.l    d1,sprwid
  3158.  
  3159.     tst.w    brtlx
  3160.     bge    brushset3
  3161.     tst.w    brbrx
  3162.     bge    brushset3
  3163.     tst.w    brtly
  3164.     bge    brushset3
  3165.     tst.w    brbry
  3166.     bge    brushset3
  3167.     bra    nomessage1
  3168.  
  3169. brushset3    move.w    brtlx,d0
  3170.     move.w    brbrx,d1
  3171.     cmp.w    d0,d1
  3172.     bge    noswap7
  3173.     
  3174.     exg    d0,d1
  3175.     
  3176. noswap7    move.w    d0,brtlx
  3177.     move.w    d1,brbrx
  3178.     move.w    brtly,d0
  3179.     move.w    brbry,d1
  3180.     cmp.w    d0,d1
  3181.     bge    noswap8
  3182.     
  3183.     exg    d0,d1
  3184.     
  3185. noswap8    move.w    d0,brtly
  3186.     move.w    d1,brbry
  3187.     
  3188.     clr.b    filename
  3189.     move.l    req2,a1
  3190.     lea    filename,a2
  3191.     lea    savetxt,a3
  3192.     lea    tags2,a0
  3193.     move.l    reqtbase,a6
  3194.     jsr    _LVOrtFileRequestA(a6)
  3195.     tst.l    d0
  3196.     beq    nomessage1
  3197.     
  3198.     move.l    req2,a1
  3199.     move.l    rtfi_Dir(a1),d1
  3200.     move.l    #SHARED_LOCK,d2
  3201.     move.l    dosbase,a6
  3202.     jsr    _LVOLock(a6)
  3203.     move.l    d0,filelock
  3204.     beq    writeerr
  3205.     
  3206.     move.l    d0,d1
  3207.     jsr    _LVOCurrentDir(a6)
  3208.     move.l    d0,olddirlock
  3209.     
  3210.     move.l    #filename,d1
  3211.     move.l    #MODE_NEWFILE,d2
  3212.     move.l    dosbase,a6
  3213.     jsr    _LVOOpen(a6)
  3214.     tst.l    d0
  3215.     beq    writeerr
  3216.     move.l    d0,handle1
  3217.     
  3218.     tst.b    sprctrl
  3219.     beq    noctrl
  3220.     
  3221.     tst.b    sprmeth
  3222.     bne    sprbinctrl
  3223.     
  3224.     cmp.l    #16,sprwid
  3225.     bne    sprwid32
  3226.     
  3227.     move.b    #'1',spr16ctrl+3
  3228.     filewrite    handle1,#spr16ctrl,#end16save-spr16ctrl
  3229.     bra    noctrl
  3230.  
  3231. sprwid32    cmp.l    #32,sprwid
  3232.     bne    sprwid64
  3233.     
  3234.     move.b    #'1',spr32ctrl+3
  3235.     filewrite    handle1,#spr32ctrl,#end32save-spr32ctrl
  3236.     bra    noctrl
  3237.  
  3238. sprwid64    move.b    #'1',spr64ctrl+3
  3239.     filewrite    handle1,#spr64ctrl,#end64save-spr64ctrl
  3240.     bra    noctrl
  3241.  
  3242. sprbinctrl    move.l    sprwid,d6
  3243.     divu    #8,d6
  3244.     and.l    #$FFFF,d6
  3245.     add.w    d6,d6
  3246.     clr.l    copybuff
  3247.     clr.l    copybuff+4
  3248.     
  3249.     filewrite    handle1,#copybuff,d6
  3250.     
  3251. noctrl    move.l    pladdr,a0
  3252.     lea    copybuff,a1
  3253.     move.w    brtly,d5
  3254.     move.l    a0,a4
  3255.     
  3256. nextline9    move.w    #1,d2
  3257.     move.w    d5,d3
  3258.     mulu    bytewid1,d3
  3259.     
  3260.     lea    0(a0,d3.l),a0
  3261.     
  3262.     clr.l    copybuff
  3263.     clr.l    copybuff+4
  3264.     clr.l    copybuff+8
  3265.     clr.l    copybuff+12
  3266.     
  3267. nextplane7    move.w    brtlx,d1
  3268.  
  3269.     cmp.w    cdepth,d2
  3270.     bgt    planeblank
  3271.     
  3272. nextbyte1    move.w    #7,d3
  3273.     clr.b    (a1)
  3274.     
  3275. nextbit1    move.w    d1,d6
  3276.     move.w    d1,d7
  3277.     not.w    d7
  3278.     and.w    #7,d7
  3279.     and.w    #$FFF8,d6
  3280.     lsr.w    #3,d6
  3281.     btst    d7,0(a0,d6.w)
  3282.     beq    bitclear1
  3283.     
  3284.     bset    d3,(a1)
  3285.     
  3286. bitclear1    add.w    #1,d1
  3287.     move.w    brtlx,d4
  3288.     add.l    sprwid,d4
  3289.     cmp.w    d4,d1
  3290.     bge    linedone4
  3291.     
  3292.     cmp.w    brbrx,d1
  3293.     bgt    linedone4
  3294.     
  3295.     sub.w    #1,d3
  3296.     bpl    nextbit1
  3297.     
  3298.     add.w    #1,a1
  3299.     bra    nextbyte1
  3300.  
  3301. linedone4    add.w    #1,a1
  3302. planeblank    move.w    iffheight,d0
  3303.     mulu    bytewid1,d0
  3304.     lea    0(a0,d0.l),a0
  3305.     
  3306.     add.w    #1,d2
  3307.     cmp.w    #3,d2
  3308.     bne    nextplane7
  3309.     
  3310.     tst.b    sprmeth
  3311.     bne    sprsavebin
  3312.     
  3313.     cmp.l    #16,sprwid
  3314.     beq    sprwid16a
  3315.     
  3316.     cmp.l    #32,sprwid
  3317.     beq    sprwid32a
  3318.     
  3319.     move.w    copybuff+14,d0
  3320.     move.w    #4,d1
  3321.     lea    sprtxt10,a0
  3322.     bsr    numtohexasc
  3323.     
  3324.     move.w    copybuff+12,d0
  3325.     move.w    #4,d1
  3326.     lea    sprtxt9,a0
  3327.     bsr    numtohexasc
  3328.     
  3329.     move.w    copybuff+10,d0
  3330.     move.w    #4,d1
  3331.     lea    sprtxt8,a0
  3332.     bsr    numtohexasc
  3333.     
  3334.     move.w    copybuff+8,d0
  3335.     move.w    #4,d1
  3336.     lea    sprtxt7,a0
  3337.     bsr    numtohexasc
  3338.     
  3339. sprwid32a    move.w    copybuff+6,d0
  3340.     move.w    #4,d1
  3341.     lea    sprtxt6,a0
  3342.     bsr    numtohexasc
  3343.     
  3344.     move.w    copybuff+4,d0
  3345.     move.w    #4,d1
  3346.     lea    sprtxt5,a0
  3347.     bsr    numtohexasc
  3348.     
  3349. sprwid16a    move.w    copybuff+2,d0
  3350.     move.w    #4,d1
  3351.     lea    sprtxt4,a0
  3352.     bsr    numtohexasc
  3353.     
  3354.     move.w    copybuff,d0
  3355.     move.w    #4,d1
  3356.     lea    sprtxt3,a0
  3357.     bsr    numtohexasc
  3358.     
  3359.     lea    sprtxt2,a0
  3360.     
  3361.     move.l    sprwid,d0
  3362.     divu    #$10,d0
  3363.     mulu    #12,d0
  3364.     lea    0(a0,d0.l),a0
  3365.     
  3366.     move.b    (a0),d6
  3367.     move.b    #10,(a0)+
  3368.     
  3369.     move.l    a0,a2
  3370.     sub.l    #sprtxt1,a2
  3371.     
  3372.     filewrite    handle1,#sprtxt1,a2
  3373.     
  3374.     move.b    d6,-(a0)
  3375.     bra    writeline
  3376.  
  3377.  
  3378. sprsavebin    move.l    sprwid,d6
  3379.     divu    #8,d6
  3380.     and.l    #$FFFF,d6
  3381.     add.w    d6,d6
  3382.     
  3383.     filewrite    handle1,#copybuff,d6
  3384.     
  3385. writeline    lea    copybuff,a1
  3386.     move.l    a4,a0
  3387.     add.w    #1,d5
  3388.     cmp.w    brbry,d5
  3389.     ble    nextline9
  3390.  
  3391.     tst.b    sprctrl
  3392.     beq    noendctrl
  3393.     
  3394.     tst.b    sprmeth
  3395.     bne    writebin
  3396.     
  3397.     cmp.l    #16,sprwid
  3398.     bne    notwid16a
  3399.     
  3400.     filewrite    handle1,#sprsaveA,#end16save-sprsaveA
  3401.     bra    noendctrl
  3402.  
  3403. notwid16a    cmp.l    #32,sprwid
  3404.     bne    notwid32a
  3405.     
  3406.     filewrite    handle1,#sprsaveB,#end32save-sprsaveB
  3407.     bra    noendctrl
  3408.  
  3409. notwid32a    filewrite    handle1,#sprsaveC,#end64save-sprsaveC
  3410.     bra    noendctrl
  3411.  
  3412. writebin    move.l    sprwid,d6
  3413.     divu    #8,d6
  3414.     and.l    #$FFFF,d6
  3415.     add.w    d6,d6
  3416.     clr.l    copybuff
  3417.     clr.l    copybuff+4
  3418.     
  3419.     filewrite    handle1,#copybuff,d6
  3420.  
  3421. noendctrl    tst.b    sprdepth
  3422.     beq    no4plspr
  3423.     
  3424.     tst.b    sprctrl
  3425.     beq    noctrl2
  3426.     
  3427.     tst.b    sprmeth
  3428.     bne    savectrlbin
  3429.     
  3430.     cmp.l    #16,sprwid
  3431.     bne    notwid16b
  3432.     
  3433.     move.b    #'2',spr16ctrl+3
  3434.     filewrite    handle1,#spr16ctrl,#end16save-spr16ctrl
  3435.     bra    noctrl2
  3436.  
  3437. notwid16b    cmp.l    #32,sprwid
  3438.     bne    notwid32b
  3439.     
  3440.     move.b    #'2',spr32ctrl+3
  3441.     filewrite    handle1,#spr32ctrl,#end32save-spr32ctrl
  3442.     bra    noctrl2
  3443.  
  3444. notwid32b    move.b    #'2',spr64ctrl+3
  3445.     filewrite    handle1,#spr64ctrl,#end64save-spr64ctrl
  3446.     bra    noctrl2
  3447.  
  3448. savectrlbin    move.l    sprwid,d6
  3449.     divu    #8,d6
  3450.     and.l    #$FFFF,d6
  3451.     add.w    d6,d6
  3452.     clr.l    copybuff
  3453.     clr.l    copybuff+4
  3454.     
  3455.     filewrite    handle1,#copybuff,d6
  3456.     
  3457. noctrl2    move.l    pladdr,a0
  3458.     move.w    bytewid1,d6
  3459.     mulu    iffheight,d6
  3460.     add.l    d6,a0
  3461.     add.l    d6,a0
  3462.     lea    copybuff,a1
  3463.     move.w    brtly,d5
  3464.     move.l    a0,a4
  3465.  
  3466. nextline10    move.w    #3,d2
  3467.     move.w    d5,d3
  3468.     mulu    bytewid1,d3
  3469.     lea    0(a0,d3.l),a0
  3470.  
  3471.     clr.l    copybuff
  3472.     clr.l    copybuff+4
  3473.     clr.l    copybuff+8
  3474.     clr.l    copybuff+12
  3475.  
  3476. nextplane8    move.w    brtlx,d1
  3477.     cmp.w    cdepth,d2
  3478.     bgt    planeblank2
  3479.  
  3480. nextbyte4    move.w    #7,d3
  3481.     clr.b    (a1)
  3482.  
  3483. nextbit4    move.w    d1,d6
  3484.     move.w    d1,d7
  3485.     not.w    d7
  3486.     and.w    #7,d7
  3487.     and.w    #$FFF8,d6
  3488.     lsr.w    #3,d6
  3489.  
  3490.     btst    d7,0(a0,d6.w)
  3491.     beq    bitclear4
  3492.  
  3493.     bset    d3,(a1)
  3494.  
  3495. bitclear4    add.w    #1,d1
  3496.     move.w    brtlx,d4
  3497.     add.l    sprwid,d4
  3498.     cmp.w    d4,d1
  3499.     bge    linedone5
  3500.  
  3501.     cmp.w    brbrx,d1
  3502.     bgt    linedone5
  3503.  
  3504.     sub.w    #1,d3
  3505.     bpl    nextbit4
  3506.  
  3507.     add.w    #1,a1
  3508.     bra    nextbyte4
  3509.  
  3510. linedone5    add.w    #1,a1
  3511.  
  3512. planeblank2    move.w    iffheight,d0
  3513.     mulu    bytewid1,d0
  3514.     lea    0(a0,d0.l),a0
  3515.     
  3516.     sub.w    #1,d2
  3517.     bne    nextplane8
  3518.  
  3519.     tst.b    sprmeth
  3520.     bne    binsave
  3521.  
  3522.     cmp.l    #16,sprwid
  3523.     beq    sprwid16c
  3524.     
  3525.     cmp.l    #32,sprwid
  3526.     beq    sprwid32c
  3527.     
  3528.     move.w    copybuff+14,d0
  3529.     move.w    #4,d1
  3530.     lea    sprtxt10,a0
  3531.     bsr    numtohexasc
  3532.     
  3533.     move.w    copybuff+12,d0
  3534.     move.w    #4,d1
  3535.     lea    sprtxt9,a0
  3536.     bsr    numtohexasc
  3537.     
  3538.     move.w    copybuff+10,d0
  3539.     move.w    #4,d1
  3540.     lea    sprtxt8,a0
  3541.     bsr    numtohexasc
  3542.     
  3543.     move.w    copybuff+8,d0
  3544.     move.w    #4,d1
  3545.     lea    sprtxt7,a0
  3546.     bsr    numtohexasc
  3547.     
  3548. sprwid32c    move.w    copybuff+6,d0
  3549.     move.w    #4,d1
  3550.     lea    sprtxt6,a0
  3551.     bsr    numtohexasc
  3552.     
  3553.     move.w    copybuff+4,d0
  3554.     move.w    #4,d1
  3555.     lea    sprtxt5,a0
  3556.     bsr    numtohexasc
  3557.     
  3558. sprwid16c    move.w    copybuff+2,d0
  3559.     move.w    #4,d1
  3560.     lea    sprtxt4,a0
  3561.     bsr    numtohexasc
  3562.     
  3563.     move.w    copybuff,d0
  3564.     move.w    #4,d1
  3565.     lea    sprtxt3,a0
  3566.     bsr    numtohexasc
  3567.     
  3568.     lea    sprtxt2,a0
  3569.     move.l    sprwid,d0
  3570.     divu    #$10,d0
  3571.     mulu    #12,d0
  3572.     lea    0(a0,d0.l),a0
  3573.     move.b    (a0),d6
  3574.     move.b    #10,(a0)+
  3575.     move.l    a0,a2
  3576.     sub.l    #sprtxt1,a2
  3577.     
  3578.     filewrite    handle1,#sprtxt1,a2
  3579.     move.b    d6,-(a0)
  3580.     bra    linewrote
  3581.  
  3582. binsave    move.l    sprwid,d6
  3583.     divu    #8,d6
  3584.     and.l    #$FFFF,d6
  3585.     add.w    d6,d6
  3586.     
  3587.     filewrite    handle1,#copybuff,d6
  3588.     
  3589. linewrote    lea    copybuff,a1
  3590.     move.l    a4,a0
  3591.     add.w    #1,d5
  3592.     cmp.w    brbry,d5
  3593.     ble    nextline10
  3594.     
  3595.     tst.b    sprctrl
  3596.     beq    noctrlend2
  3597.     
  3598.     tst.b    sprmeth
  3599.     bne    sprbinsave2
  3600.     
  3601.     cmp.l    #16,sprwid
  3602.     bne    notwid16c
  3603.     
  3604.     filewrite    handle1,#sprsaveA,#end16save-sprsaveA
  3605.     bra    no4plspr
  3606.  
  3607. notwid16c    cmp.l    #32,sprwid
  3608.     bne    notwid32c
  3609.     
  3610.     filewrite    handle1,#sprsaveB,#end32save-sprsaveB
  3611.     bra    no4plspr
  3612.  
  3613. notwid32c    filewrite    handle1,#sprsaveC,#end64save-sprsaveC
  3614.     bra    no4plspr
  3615.  
  3616. sprbinsave2    move.l    sprwid,d6
  3617.     divu    #8,d6
  3618.     and.l    #$FFFF,d6
  3619.     add.w    d6,d6
  3620.     clr.l    copybuff
  3621.     clr.l    copybuff+4
  3622.     
  3623.     filewrite    handle1,#copybuff,d6
  3624.  
  3625. noctrlend2
  3626. no4plspr    bsr    closefile
  3627.     bra    nomessage1
  3628.  
  3629. savepalbin    tst.b    paltype
  3630.     beq    pal12bit
  3631.     
  3632.     move.w    #1,d0
  3633.     move.w    cdepth,d1
  3634.     lsl.w    d1,d0
  3635.     mulu    #3,d0
  3636.     move.l    handle1,d1
  3637.     move.l    #palstore1,d2
  3638.     move.l    d0,d3
  3639.     move.l    d3,d7
  3640.     jsr    _LVOWrite(a6)
  3641.     cmp.l    d7,d0
  3642.     rts
  3643.  
  3644. pal12bit    move.w    #1,d6
  3645.     move.w    cdepth,d5
  3646.     lsl.w    d5,d6
  3647.     sub.w    #1,d6
  3648.     lea    palstore1,a5
  3649.     
  3650. save12pal    clr.w    d2
  3651.     move.b    (a5)+,d2
  3652.     and.b    #$F0,d2
  3653.     lsl.w    #4,d2
  3654.     or.b    (a5)+,d2
  3655.     and.w    #$FF0,d2
  3656.     lsl.w    #4,d2
  3657.     or.b    (a5)+,d2
  3658.     and.w    #$FFF0,d2
  3659.     lsr.w    #4,d2
  3660.     move.w    d2,store1
  3661.     
  3662.     move.l    handle1,d1
  3663.     move.l    #store1,d2
  3664.     move.l    #2,d3
  3665.     jsr    _LVOWrite(a6)
  3666.     cmp.l    #2,d0
  3667.     bne    palsaveerr
  3668.     
  3669.     dbf    d6,save12pal
  3670.     
  3671.     moveq    #0,d0
  3672.     rts
  3673.  
  3674. palsaveerr    move.l    #-1,d0
  3675.     rts
  3676.  
  3677. palsavesrc    tst.b    paltype
  3678.     beq    pal12bit2
  3679.     
  3680.     move.w    #1,d6
  3681.     move.w    cdepth,d5
  3682.     lsl.w    d5,d6
  3683.     sub.w    #1,d6
  3684.     lea    palstore1,a5
  3685.     
  3686. palwrite    lea    pal24mod1,a0
  3687.     move.b    (a5)+,d0
  3688.     move.w    #2,d1
  3689.     bsr    numtohexasc
  3690.     
  3691.     lea    pal24mod2,a0
  3692.     move.b    (a5)+,d0
  3693.     move.w    #2,d1
  3694.     bsr    numtohexasc
  3695.     
  3696.     lea    pal24mod3,a0
  3697.     move.b    (a5)+,d0
  3698.     move.w    #2,d1
  3699.     bsr    numtohexasc
  3700.     
  3701.     move.l    handle1,d1
  3702.     move.l    #pal24src,d2
  3703.     move.l    #endpal24-pal24src,d3
  3704.     jsr    _LVOWrite(a6)
  3705.     cmp.l    #endpal24-pal24src,d0
  3706.     bne    palsaveerr
  3707.     
  3708.     dbf    d6,palwrite
  3709.     
  3710.     moveq    #0,d0
  3711.     rts
  3712.  
  3713. pal12bit2    move.w    #1,d6
  3714.     move.w    cdepth,d5
  3715.     lsl.w    d5,d6
  3716.     sub.w    #1,d6
  3717.     lea    palstore1,a5
  3718.     
  3719. palwrite2    clr.w    d2
  3720.     move.b    (a5)+,d2
  3721.     and.b    #$F0,d2
  3722.     lsl.w    #4,d2
  3723.     or.b    (a5)+,d2
  3724.     and.w    #$FF0,d2
  3725.     lsl.w    #4,d2
  3726.     or.b    (a5)+,d2
  3727.     and.w    #$FFF0,d2
  3728.     lsr.w    #4,d2
  3729.     
  3730.     move.w    d2,d0
  3731.     move.w    #4,d1
  3732.     lea    pal12mod1,a0
  3733.     bsr    numtohexasc
  3734.     
  3735.     move.l    handle1,d1
  3736.     move.l    #pal12src,d2
  3737.     move.l    #endpal12-pal12src,d3
  3738.     jsr    _LVOWrite(a6)
  3739.     cmp.l    #endpal12-pal12src,d0
  3740.     bne    palsaveerr
  3741.     
  3742.     dbf    d6,palwrite2
  3743.     moveq    #0,d0
  3744.     rts
  3745.  
  3746. palsavecop    move.l    #1,d4
  3747.     move.w    cdepth,d1
  3748.     lsl.l    d1,d4
  3749.     move.w    #$180,d7
  3750.     clr.w    d6
  3751.     clr.w    d5
  3752.     lea    palstore1,a5
  3753.     
  3754. palwrite3    lea    copmod2,a0
  3755.     move.w    d5,d0
  3756.     move.w    #4,d1
  3757.     bsr    numtohexasc
  3758.     
  3759.     lea    copmod1,a0
  3760.     move.w    #3,d1
  3761.     move.w    #$106,d0
  3762.     bsr    numtohexasc
  3763.     
  3764.     move.l    handle1,d1
  3765.     move.l    #copsrc1,d2
  3766.     move.l    #endcop1-copsrc1,d3
  3767.     jsr    _LVOWrite(a6)
  3768.     cmp.l    #endcop1-copsrc1,d0
  3769.     bne    writeerr
  3770.     
  3771. palwrite4    clr.w    d0
  3772.     move.b    (a5)+,d0
  3773.     and.b    #$F0,d0
  3774.     lsl.w    #4,d0
  3775.     or.b    (a5)+,d0
  3776.     and.b    #$F0,d0
  3777.     lsl.w    #4,d0
  3778.     or.b    (a5)+,d0
  3779.     
  3780.     lsr.w    #4,d0
  3781.     lea    copmod2,a0
  3782.     move.w    #4,d1
  3783.     bsr    numtohexasc
  3784.     
  3785.     lea    copmod1,a0
  3786.     move.w    #3,d1
  3787.     move.w    d7,d0
  3788.     bsr    numtohexasc
  3789.     
  3790.     move.l    handle1,d1
  3791.     move.l    #copsrc1,d2
  3792.     move.l    #endcop1-copsrc1,d3
  3793.     jsr    _LVOWrite(a6)
  3794.     cmp.l    #endcop1-copsrc1,d0
  3795.     bne    writeerr
  3796.     
  3797.     add.w    #2,d7
  3798.     add.w    #1,d6
  3799.     sub.w    #1,d4
  3800.     beq    palwrote
  3801.     
  3802.     and.w    #$1F,d6
  3803.     bne    palwrite4
  3804.     
  3805.     move.w    #$180,d7
  3806.     clr.w    d6
  3807.     add.w    #$2000,d5
  3808.     bra    palwrite3
  3809.  
  3810. palwrote    tst.b    paltype
  3811.     beq    palsaved
  3812.     
  3813.     move.l    #1,d4
  3814.     move.w    cdepth,d1
  3815.     lsl.l    d1,d4
  3816.     move.w    #$180,d7
  3817.     move.w    #$200,d5
  3818.     clr.w    d6
  3819.     lea    palstore1,a5
  3820.     
  3821. palwrite5    lea    copmod2,a0
  3822.     move.w    d5,d0
  3823.     move.w    #4,d1
  3824.     bsr    numtohexasc
  3825.     
  3826.     lea    copmod1,a0
  3827.     move.w    #3,d1
  3828.     move.w    #$106,d0
  3829.     bsr    numtohexasc
  3830.     
  3831.     move.l    handle1,d1
  3832.     move.l    #copsrc1,d2
  3833.     move.l    #endcop1-copsrc1,d3
  3834.     jsr    _LVOWrite(a6)
  3835.     cmp.l    #endcop1-copsrc1,d0
  3836.     bne    writeerr
  3837.     
  3838. palwrite6    clr.w    d0
  3839.     move.b    (a5)+,d0
  3840.     and.b    #15,d0
  3841.     lsl.w    #8,d0
  3842.     or.b    (a5)+,d0
  3843.     and.b    #15,d0
  3844.     lsl.b    #4,d0
  3845.     lsl.w    #4,d0
  3846.     or.b    (a5)+,d0
  3847.     lsl.b    #4,d0
  3848.     lsr.w    #4,d0
  3849.     
  3850.     lea    copmod2,a0
  3851.     move.w    #4,d1
  3852.     bsr    numtohexasc
  3853.     
  3854.     lea    copmod1,a0
  3855.     move.w    #3,d1
  3856.     move.w    d7,d0
  3857.     bsr    numtohexasc
  3858.     
  3859.     move.l    handle1,d1
  3860.     move.l    #copsrc1,d2
  3861.     move.l    #endcop1-copsrc1,d3
  3862.     jsr    _LVOWrite(a6)
  3863.     cmp.l    #endcop1-copsrc1,d0
  3864.     bne    writeerr
  3865.     
  3866.     add.w    #2,d7
  3867.     add.w    #1,d6
  3868.     sub.w    #1,d4
  3869.     beq    palsaved
  3870.     
  3871.     and.w    #$1F,d6
  3872.     bne    palwrite6
  3873.     
  3874.     move.w    #$180,d7
  3875.     clr.w    d6
  3876.     add.w    #$2000,d5
  3877.     bra    palwrite5
  3878.  
  3879. palsaved    bsr    closefile
  3880.     rts
  3881.  
  3882. writeerr    bsr    closeLSwin
  3883.     bsr    closefile
  3884.  
  3885.     lea    bodyfmt6,a1
  3886.     lea    gadfmt6,a2
  3887.     lea    taglist,a0
  3888.     lea    0,a3
  3889.     lea    0,a4
  3890.     move.l    reqtbase,a6
  3891.     jsr    _LVOrtEZRequestA(a6)
  3892.     bsr    fakebpl
  3893.     bra    nomessage1
  3894.  
  3895.  
  3896. prefs    move.l    intuibase,a6
  3897.     jsr    _LVOWBenchToFront(a6)
  3898.     
  3899.     lea    newprefswin,a0
  3900.     jsr    _LVOOpenWindow(a6)
  3901.     move.l    d0,prefswin
  3902.     beq    noprefswin
  3903.     
  3904.     moveq    #0,d0
  3905.     bsr    settxt
  3906.     
  3907.     lea    newprefs,a0
  3908.     lea    oldprefs,a1
  3909.     move.w    #endnewprefs-newprefs-1,d0
  3910. storeprefs    move.b    (a0)+,(a1)+
  3911.     dbf    d0,storeprefs
  3912.     
  3913. nomessage2    move.l    #1,d1
  3914.     move.l    dosbase,a6
  3915.     jsr    _LVODelay(a6)
  3916.     
  3917.     move.l    prefswin,a0
  3918.     move.l    wd_UserPort(a0),a0
  3919.     move.l    4.w,a6
  3920.     jsr    _LVOGetMsg(a6)
  3921.     tst.l    d0
  3922.     beq    nomessage2
  3923.     
  3924.     move.l    d0,message
  3925.     move.l    d0,a1
  3926.     jsr    _LVOReplyMsg(a6)
  3927.     
  3928.     move.l    message,a0
  3929.     move.l    $14(a0),d0
  3930.     cmp.l    #CLOSEWINDOW,d0
  3931.     beq    prefsclose
  3932.     
  3933.     cmp.l    #GADGETUP,d0
  3934.     bne    nomessage2
  3935.     
  3936.     move.l    $1C(a0),a1
  3937.  
  3938.     lea    prefstable,a0
  3939. findrout    cmp.l    (a0)+,a1
  3940.     beq    foundrout
  3941.     add.l    #4,a0
  3942.     tst.l    (a0)
  3943.     bne    findrout
  3944.     bra    nomessage2
  3945.  
  3946. foundrout    move.l    (a0)+,a0
  3947.     jsr    (a0)
  3948.     bra    nomessage2
  3949.  
  3950. prefsclose    move.l    scrpt1,a0
  3951.     move.l    intuibase,a6
  3952.     jsr    _LVOScreenToFront(a6)
  3953.     
  3954.     move.l    prefswin,a0
  3955.     jsr    _LVOCloseWindow(a6)
  3956.     bra    nomessage1
  3957.  
  3958. prefsbplmeth
  3959.     add.b    #1,bplmeth
  3960.     and.b    #1,bplmeth
  3961.     move.l    #1,d0
  3962.     bsr    settxt
  3963.     rts
  3964.  
  3965. prefspalinfo
  3966.     add.b    #1,palinfo
  3967.     cmp.b    #3,palinfo
  3968.     blt    noloop1
  3969.     clr.b    palinfo
  3970. noloop1    move.l    #2,d0
  3971.     bsr    settxt
  3972.     rts
  3973.  
  3974. prefspaltype
  3975.     add.b    #1,paltype
  3976.     and.b    #1,paltype
  3977.     move.l    #3,d0
  3978.     bsr    settxt
  3979.     rts
  3980.  
  3981. prefspalmeth
  3982.     add.b    #1,palmeth
  3983.     cmp.b    #3,palmeth
  3984.     blt    noloop2
  3985.     clr.b    palmeth
  3986. noloop2    move.l    #4,d0
  3987.     bsr    settxt
  3988.     rts
  3989.  
  3990. prefssprmeth
  3991.     add.b    #1,sprmeth
  3992.     and.b    #1,sprmeth
  3993.     move.l    #5,d0
  3994.     bsr    settxt
  3995.     rts
  3996.  
  3997. prefssprctrl
  3998.     add.b    #1,sprctrl
  3999.     and.b    #1,sprctrl
  4000.     move.l    #6,d0
  4001.     bsr    settxt
  4002.     rts
  4003.  
  4004. prefssprdepth
  4005.     add.b    #1,sprdepth
  4006.     and.b    #1,sprdepth
  4007.     move.l    #7,d0
  4008.     bsr    settxt
  4009.     rts
  4010.  
  4011. prefsextrablit
  4012.     add.b    #1,extrablit
  4013.     cmp.b    #3,extrablit
  4014.     blt    noloop3
  4015.     clr.b    extrablit
  4016. noloop3    move.l    #8,d0
  4017.     bsr    settxt
  4018.     rts
  4019.  
  4020. prefscomp    add.b    #1,iffcomp
  4021.     and.b    #1,iffcomp
  4022.     move.l    #9,d0
  4023.     bsr    settxt
  4024.     rts
  4025.  
  4026. undoprefs    lea    oldprefs,a0
  4027.     lea    newprefs,a1
  4028.     move.w    #endnewprefs-newprefs-1,d0
  4029. undoloop    move.b    (a0)+,(a1)+
  4030.     dbf    d0,undoloop
  4031.     moveq    #0,d0
  4032.     bsr    settxt
  4033. prefsquit    move.l    (sp)+,d0
  4034.     bra    prefsclose
  4035.  
  4036. prefssave    move.l    req1,a0
  4037.     move.l    rtfi_Dir(a0),a0
  4038.     
  4039.     lea    loaddir,a1
  4040.     move.w    #256-1,d0
  4041. copy1    move.b    (a0)+,(a1)+
  4042.     dbf    d0,copy1
  4043.     
  4044.     move.l    req2,a0
  4045.     move.l    rtfi_Dir(a0),a0
  4046.     
  4047.     lea    savedir,a1
  4048.     move.w    #256-1,d0
  4049. copy2    move.b    (a0)+,(a1)+
  4050.     dbf    d0,copy2
  4051.     
  4052.     move.l    #prefsname,d1
  4053.     move.l    #MODE_NEWFILE,d2
  4054.     move.l    dosbase,a6
  4055.     jsr    _LVOOpen(a6)
  4056.     tst.l    d0
  4057.     beq    noprefssave
  4058.     
  4059.     move.l    d0,d1
  4060.     move.l    d0,d6
  4061.     move.l    #newprefs,d2
  4062.     move.l    #endnewprefs-newprefs,d3
  4063.     jsr    _LVOWrite(a6)
  4064.     
  4065.     move.l    d0,d5
  4066.     move.l    d6,d1
  4067.     jsr    _LVOClose(a6)
  4068.     
  4069.     cmp.l    #endnewprefs-newprefs,d5
  4070.     bne    noprefssave
  4071.     
  4072.     move.l    (sp)+,d0
  4073.     bra    prefsclose
  4074.  
  4075. noprefssave    lea    bodyfmt8,a1
  4076.     lea    gadfmt8,a2
  4077.     lea    taglist,a0
  4078.     lea    0,a3
  4079.     lea    0,a4
  4080.     move.l    reqtbase,a6
  4081.     jsr    _LVOrtEZRequestA(a6)
  4082.     move.l    (sp)+,d0
  4083.     bra    prefsclose
  4084.  
  4085. settxt    move.l    d0,-(sp)
  4086.     lea    savemethtxt,a0
  4087.     move.b    bplmeth,d0
  4088.     ext.w    d0
  4089.     lsl.w    #2,d0
  4090.     move.l    0(a0,d0.w),a0
  4091.     lea    ptxt1a,a1
  4092.     rept    11
  4093.     move.b    (a0)+,(a1)+
  4094.     endr
  4095.     
  4096.     lea    palinfotxt,a0
  4097.     move.b    palinfo,d0
  4098.     ext.w    d0
  4099.     lsl.w    #2,d0
  4100.     move.l    0(a0,d0.w),a0
  4101.     lea    ptxt2a,a1
  4102.  
  4103.     rept    6
  4104.     move.b    (a0)+,(a1)+
  4105.     endr
  4106.     
  4107.     lea    paltypetxt,a0
  4108.     move.b    paltype,d0
  4109.     ext.w    d0
  4110.     lsl.w    #2,d0
  4111.     move.l    0(a0,d0.w),a0
  4112.     lea    ptxt3a,a1
  4113.     
  4114.     rept    6
  4115.     move.b    (a0)+,(a1)+
  4116.     endr
  4117.     
  4118.     lea    palmethtxt,a0
  4119.     move.b    palmeth,d0
  4120.     ext.w    d0
  4121.     lsl.w    #2,d0
  4122.     move.l    0(a0,d0.w),a0
  4123.     lea    ptxt4a,a1
  4124.     
  4125.     rept    13
  4126.     move.b    (a0)+,(a1)+
  4127.     endr
  4128.     
  4129.     lea    sprmethtxt,a0
  4130.     move.b    sprmeth,d0
  4131.     ext.w    d0
  4132.     lsl.w    #2,d0
  4133.     move.l    0(a0,d0.w),a0
  4134.     lea    ptxt5a,a1
  4135.     
  4136.     rept    6
  4137.     move.b    (a0)+,(a1)+
  4138.     endr
  4139.     
  4140.     lea    sprctrltxt,a0
  4141.     move.b    sprctrl,d0
  4142.     ext.w    d0
  4143.     lsl.w    #2,d0
  4144.     move.l    0(a0,d0.w),a0
  4145.     lea    ptxt6a,a1
  4146.     
  4147.     rept    3
  4148.     move.b    (a0)+,(a1)+
  4149.     endr
  4150.     
  4151.     lea    sprdeptxt,a0
  4152.     move.b    sprdepth,d0
  4153.     ext.w    d0
  4154.     lsl.w    #2,d0
  4155.     move.l    0(a0,d0.w),a0
  4156.     lea    ptxt7a,a1
  4157.     
  4158.     rept    10
  4159.     move.b    (a0)+,(a1)+
  4160.     endr
  4161.     
  4162.     lea    xtrablittxt,a0
  4163.     move.b    extrablit,d0
  4164.     ext.w    d0
  4165.     lsl.w    #2,d0
  4166.     move.l    0(a0,d0.w),a0
  4167.     lea    ptxt8a,a1
  4168.     
  4169.     rept    5
  4170.     move.b    (a0)+,(a1)+
  4171.     endr
  4172.     
  4173.     lea    iffcomptxt,a0
  4174.     move.b    iffcomp,d0
  4175.     ext.w    d0
  4176.     lsl.w    #2,d0
  4177.     move.l    0(a0,d0.w),a0
  4178.     lea    ptxt9a,a1
  4179.     
  4180.     rept    10
  4181.     move.b    (a0)+,(a1)+
  4182.     endr
  4183.     
  4184.     move.l    (sp)+,d0
  4185.     bne    updategad
  4186.     
  4187.     move.l    gfxbase,a6
  4188.     move.l    scrpt1,a0
  4189.     lea    sc_ViewPort(a0),a0
  4190.     jsr    _LVOWaitBOVP(a6)
  4191.     move.l    intuibase,a6
  4192.     lea    prefsgad1,a0
  4193.     move.l    prefswin,a1
  4194.     sub.l    a2,a2
  4195.     jsr    _LVORefreshGadgets(a6)
  4196.     rts
  4197.  
  4198. updategad    lea    prefsgad1,a0
  4199. findpgad    sub.l    #1,d0
  4200.     beq    pgadfound
  4201.     move.l    (a0),a0
  4202.     bra    findpgad
  4203.  
  4204. pgadfound    move.l    a0,-(sp)
  4205.     move.l    gfxbase,a6
  4206.     move.l    scrpt1,a0
  4207.     lea    sc_ViewPort(a0),a0
  4208.     jsr    _LVOWaitBOVP(a6)
  4209.     
  4210.     move.l    (sp)+,a0
  4211.     
  4212.     move.l    intuibase,a6
  4213.     move.l    prefswin,a1
  4214.     sub.l    a2,a2
  4215.     move.l    #1,d0
  4216.     jsr    _LVORefreshGList(a6)
  4217.     rts
  4218.  
  4219. noprefswin    lea    bodyfmt7,a1
  4220.     lea    gadfmt7,a2
  4221.     lea    taglist,a0
  4222.     lea    0,a3
  4223.     lea    0,a4
  4224.     move.l    reqtbase,a6
  4225.     jsr    _LVOrtEZRequestA(a6)
  4226.     bra    nomessage1
  4227.  
  4228. about    lea    menupal,a1
  4229.     move.l    scrpt1,a0
  4230.     lea    sc_ViewPort(a0),a0
  4231.     move.l    #4,d0
  4232.     move.l    gfxbase,a6
  4233.     jsr    _LVOLoadRGB4(a6)
  4234.     
  4235.     lea    bodyfmt1,a1
  4236.     lea    gadfmt1,a2
  4237.     lea    taglist,a0
  4238.     lea    0,a3
  4239.     lea    0,a4
  4240.     move.l    reqtbase,a6
  4241.     jsr    _LVOrtEZRequestA(a6)
  4242.     
  4243.     bsr    fakebpl
  4244.     bra    nomessage1
  4245.  
  4246. initbrush    tst.w    brtlx
  4247.     bge    brushset4
  4248.     tst.w    brtly
  4249.     bge    brushset4
  4250.     tst.w    brbrx
  4251.     bge    brushset4
  4252.     tst.w    brbry
  4253.     bge    brushset4
  4254.     rts
  4255.  
  4256. brushset4    bsr    drawbrushgrid
  4257.     move.w    #$FFFF,brtlx
  4258.     move.w    #$FFFF,brtly
  4259.     move.w    #$FFFF,brbrx
  4260.     move.w    #$FFFF,brbry
  4261.     sf    brushon
  4262.     bsr    updatecoords
  4263.     rts
  4264.  
  4265. brush    bsr    initbrush
  4266.     bra    nomessage1
  4267.  
  4268. setpalette    lea    taglist2,a0
  4269.     lea    palreqtxt,a2
  4270.     sub.l    a3,a3
  4271.     move.l    reqtbase,a6
  4272.     jsr    _LVOrtPaletteRequestA(a6)
  4273.     
  4274.     tst.l    gfx39base
  4275.     beq    nogfx39c
  4276.     move.l    scrpt1,a0
  4277.     lea    sc_ViewPort(a0),a0
  4278.     move.l    vp_ColorMap(a0),a0    ;get color map address
  4279.     moveq    #0,d0        ;first color
  4280.     move.l    #1,d1
  4281.     move.w    iffdepth,d2
  4282.     lsl.l    d2,d1
  4283.     lea    palstore2,a1
  4284.     move.l    gfx39base,a6
  4285.     jsr    _LVOGetRGB32(a6)
  4286.     bra    gotpalette
  4287.  
  4288. nogfx39c    move.l    gfxbase,a6
  4289.     moveq    #0,d5
  4290.     move.l    #1,d6
  4291.     move.w    iffdepth,d7
  4292.     lsl.l    d7,d6
  4293.     sub.l    #1,d6
  4294.     lea    palstore2,a5
  4295.     
  4296. getpalette    move.l    scrpt1,a0
  4297.     lea    sc_ViewPort(a0),a0
  4298.     move.l    vp_ColorMap(a0),a0    ;get color map address
  4299.     move.l    d5,d0
  4300.     jsr    _LVOGetRGB4(a6)
  4301.     move.w    d0,d1
  4302.  
  4303.     and.l    #$f00,d1
  4304.     lsl.w    #4,d1
  4305.     move.w    d1,d2
  4306.     rept    3
  4307.     lsr.w    #4,d2
  4308.     or.w    d2,d1
  4309.     endr
  4310.     move.w    d1,d2
  4311.     swap    d2
  4312.     clr.w    d2
  4313.     or.l    d2,d1
  4314.     move.l    d1,(a5)+
  4315.  
  4316.     move.w    d0,d1
  4317.     and.l    #$0f0,d1
  4318.     lsl.w    #8,d1
  4319.     move.w    d1,d2
  4320.     rept    3
  4321.     lsr.w    #4,d2
  4322.     or.w    d2,d1
  4323.     endr
  4324.     move.w    d1,d2
  4325.     swap    d2
  4326.     clr.w    d2
  4327.     or.l    d2,d1
  4328.     move.l    d1,(a5)+
  4329.  
  4330.     move.w    d0,d1
  4331.     and.l    #$00f,d1
  4332.     ror.w    #4,d1
  4333.     move.w    d1,d2
  4334.     rept    3
  4335.     lsr.w    #4,d2
  4336.     or.w    d2,d1
  4337.     endr
  4338.     move.w    d1,d2
  4339.     swap    d2
  4340.     clr.w    d2
  4341.     or.l    d2,d1
  4342.     move.l    d1,(a5)+
  4343.     
  4344.     add.l    #1,d5
  4345.     dbf    d6,getpalette
  4346.  
  4347. gotpalette    lea    palstore2,a0
  4348.     lea    palstore1,a1
  4349.     move.l    #1,d0
  4350.     move.w    iffdepth,d1
  4351.     lsl.l    d1,d0
  4352.     mulu    #3,d0
  4353.     sub.l    #1,d0
  4354.     
  4355. remakepal1    move.l    (a0)+,d2
  4356.     swap    d2
  4357.     lsr.w    #8,d2
  4358.     move.b    d2,(a1)+
  4359.     dbf    d0,remakepal1
  4360.  
  4361.     bsr    fakebpl    
  4362.     rts
  4363.  
  4364. palette    bsr    setpalette
  4365.     bra    nomessage1
  4366.  
  4367. savepal    clr.b    filename
  4368.     move.l    req2,a1
  4369.     lea    filename,a2
  4370.     lea    savpaltxt,a3
  4371.     lea    tags2,a0
  4372.     move.l    reqtbase,a6
  4373.     jsr    _LVOrtFileRequestA(a6)
  4374.     tst.l    d0
  4375.     beq    nomessage1
  4376.     
  4377.     move.l    req2,a1
  4378.     move.l    rtfi_Dir(a1),d1
  4379.     move.l    #SHARED_LOCK,d2
  4380.     move.l    dosbase,a6
  4381.     jsr    _LVOLock(a6)
  4382.     move.l    d0,filelock
  4383.     beq    writeerr
  4384.     
  4385.     move.l    d0,d1
  4386.     jsr    _LVOCurrentDir(a6)
  4387.     move.l    d0,olddirlock
  4388.     
  4389.     move.l    #filename,d1
  4390.     move.l    #MODE_NEWFILE,d2
  4391.     move.l    dosbase,a6
  4392.     jsr    _LVOOpen(a6)
  4393.     move.l    d0,handle1
  4394.     tst.l    d0
  4395.     beq    writeerr
  4396.     move.l    d0,handle1
  4397.     
  4398.     tst.b    palmeth
  4399.     bne    notsrcsave
  4400.     
  4401.     bsr    palsavesrc
  4402.     bne    writeerr
  4403.     
  4404.     bra    palsaved2
  4405.  
  4406. notsrcsave    cmp.b    #1,palmeth
  4407.     bne    notcopsave
  4408.     
  4409.     bsr    palsavecop
  4410.     bne    writeerr
  4411.     
  4412.     bra    palsaved2
  4413.  
  4414. notcopsave    bsr    savepalbin
  4415.     bne    writeerr
  4416.     
  4417. palsaved2    bsr    closefile
  4418.     bra    nomessage1
  4419.  
  4420.  
  4421. savepicmask    clr.b    filename
  4422.     move.l    req2,a1
  4423.     lea    filename,a2
  4424.     lea    savmasktxt,a3
  4425.     lea    tags2,a0
  4426.     move.l    reqtbase,a6
  4427.     jsr    _LVOrtFileRequestA(a6)
  4428.     tst.l    d0
  4429.     beq    nomessage1
  4430.     
  4431.     lea    menupal,a1
  4432.     move.l    scrpt1,a0
  4433.     lea    sc_ViewPort(a0),a0
  4434.     move.l    #4,d0
  4435.     move.l    gfxbase,a6
  4436.     jsr    _LVOLoadRGB4(a6)
  4437.  
  4438.     move.l    #mwintitle,windowtitle
  4439.     lea    newloadwin,a0
  4440.     move.l    intuibase,a6
  4441.     jsr    _LVOOpenWindow(a6)
  4442.     move.l    d0,lswindow
  4443.     
  4444.     bsr    drawLSwin
  4445.  
  4446.     move.l    req2,a1
  4447.     move.l    rtfi_Dir(a1),d1
  4448.     move.l    #SHARED_LOCK,d2
  4449.     move.l    dosbase,a6
  4450.     jsr    _LVOLock(a6)
  4451.     move.l    d0,filelock
  4452.     beq    writeerr
  4453.     
  4454.     move.l    d0,d1
  4455.     jsr    _LVOCurrentDir(a6)
  4456.     move.l    d0,olddirlock
  4457.     
  4458.     move.l    #filename,d1
  4459.     move.l    #MODE_NEWFILE,d2
  4460.     move.l    dosbase,a6
  4461.     jsr    _LVOOpen(a6)
  4462.     tst.l    d0
  4463.     beq    writeerr
  4464.     move.l    d0,handle1
  4465.     
  4466.     move.l    pladdr,a0
  4467.     move.w    iffheight,d0
  4468.     mulu    bytewid1,d0
  4469.     move.w    iffheight,d4
  4470.     lea    copybuff,a5
  4471.     
  4472. nextline11    move.w    d4,lineno
  4473.     move.w    iffheight,maxline
  4474.     bsr    updateLSwin
  4475.  
  4476.     move.w    bytewid1,d2
  4477.     lsr.l    #1,d2
  4478.     cmp.b    #1,extrablit
  4479.     bne    nobuffend1
  4480.     
  4481.     clr.w    (a5)+
  4482.     cmp.l    #copybuffend,a5
  4483.     bne    nobuffend1
  4484.     
  4485.     lea    copybuff,a5
  4486.     movem.l    d0/d2/a0,-(sp)
  4487.     move.l    handle1,d1
  4488.     move.l    #copybuff,d2
  4489.     move.l    #copybuffend-copybuff,d3
  4490.     jsr    _LVOWrite(a6)
  4491.     movem.l    (sp)+,d1/d2/a0
  4492.     cmp.l    #copybuffend-copybuff,d0
  4493.     bne    writeerr
  4494.     move.w    d1,d0
  4495.     
  4496. nobuffend1    move.w    cdepth,d1
  4497.     sub.w    #1,d1
  4498.     clr.w    d7
  4499.     move.l    a0,-(sp)
  4500.     
  4501. skipplanes    or.w    (a0),d7
  4502.     lea    0(a0,d0.l),a0
  4503.     dbf    d1,skipplanes
  4504.     
  4505.     move.l    (sp)+,a0
  4506.     
  4507.     add.l    #2,a0
  4508.     not.w    d7
  4509.     move.w    d7,(a5)+
  4510.     cmp.l    #copybuffend,a5
  4511.     bne    nobuffend2
  4512.     
  4513.     lea    copybuff,a5
  4514.     movem.l    d0/d2/a0,-(sp)
  4515.     move.l    handle1,d1
  4516.     move.l    #copybuff,d2
  4517.     move.l    #copybuffend-copybuff,d3
  4518.     jsr    _LVOWrite(a6)
  4519.     movem.l    (sp)+,d1/d2/a0
  4520.     cmp.l    #copybuffend-copybuff,d0
  4521.     bne    writeerr
  4522.     move.w    d1,d0
  4523.     
  4524. nobuffend2    sub.l    #1,d2
  4525.     bne    nobuffend1
  4526.     
  4527.     cmp.b    #2,extrablit
  4528.     bne    nobuffend3
  4529.     
  4530.     clr.w    (a5)+
  4531.     cmp.l    #copybuffend,a5
  4532.     bne    nobuffend3
  4533.     
  4534.     lea    copybuff,a5
  4535.     movem.l    d0/d2/a0,-(sp)
  4536.     move.l    handle1,d1
  4537.     move.l    #copybuff,d2
  4538.     move.l    #copybuffend-copybuff,d3
  4539.     jsr    _LVOWrite(a6)
  4540.     movem.l    (sp)+,d1/d2/a0
  4541.     cmp.l    #copybuffend-copybuff,d0
  4542.     bne    writeerr
  4543.     move.w    d1,d0
  4544.     
  4545. nobuffend3    sub.w    #1,d4
  4546.     bne    nextline11
  4547.     
  4548.     movem.l    d0/d2/a0,-(sp)
  4549.     move.l    handle1,d1
  4550.     move.l    #copybuff,d2
  4551.     move.l    a5,d3
  4552.     sub.l    #copybuff,d3
  4553.     move.l    d3,d6
  4554.     jsr    _LVOWrite(a6)
  4555.     movem.l    (sp)+,d1/d2/a0
  4556.     cmp.l    d6,d0
  4557.     bne    writeerr
  4558.     
  4559.     bsr    closeLSwin
  4560.     bsr    closefile
  4561.     bsr    fakebpl
  4562.     bra    nomessage1
  4563.  
  4564. savebrmask    tst.w    brtlx
  4565.     bge    brushset5
  4566.     tst.w    brbrx
  4567.     bge    brushset5
  4568.     tst.w    brtly
  4569.     bge    brushset5
  4570.     tst.w    brbry
  4571.     bge    brushset5
  4572.     bra    nomessage1
  4573.  
  4574. brushset5    clr.b    filename
  4575.     move.l    req2,a1
  4576.     lea    filename,a2
  4577.     lea    savmasktxt,a3
  4578.     lea    tags2,a0
  4579.     move.l    reqtbase,a6
  4580.     jsr    _LVOrtFileRequestA(a6)
  4581.     tst.l    d0
  4582.     beq    nomessage1
  4583.     
  4584.     lea    menupal,a1
  4585.     move.l    scrpt1,a0
  4586.     lea    sc_ViewPort(a0),a0
  4587.     move.l    #4,d0
  4588.     move.l    gfxbase,a6
  4589.     jsr    _LVOLoadRGB4(a6)
  4590.  
  4591.     move.l    #mwintitle,windowtitle
  4592.     lea    newloadwin,a0
  4593.     move.l    intuibase,a6
  4594.     jsr    _LVOOpenWindow(a6)
  4595.     move.l    d0,lswindow
  4596.     
  4597.     bsr    drawLSwin
  4598.  
  4599.     move.l    req2,a1
  4600.     move.l    rtfi_Dir(a1),d1
  4601.     move.l    #SHARED_LOCK,d2
  4602.     move.l    dosbase,a6
  4603.     jsr    _LVOLock(a6)
  4604.     move.l    d0,filelock
  4605.     beq    writeerr
  4606.     
  4607.     move.l    d0,d1
  4608.     jsr    _LVOCurrentDir(a6)
  4609.     move.l    d0,olddirlock
  4610.     
  4611.     move.l    #filename,d1
  4612.     move.l    #MODE_NEWFILE,d2
  4613.     move.l    dosbase,a6
  4614.     jsr    _LVOOpen(a6)
  4615.     tst.l    d0
  4616.     beq    writeerr
  4617.     move.l    d0,handle1
  4618.     
  4619.     move.l    pladdr,a0
  4620.     lea    copybuff,a1
  4621.     move.w    brtly,d5
  4622.     move.l    a0,a4
  4623.     
  4624. nextline12    move.w    brbry,lineno
  4625.     sub.w    d5,lineno
  4626.     move.w    brbry,maxline
  4627.     move.w    brtly,d7
  4628.     sub.w    d7,maxline
  4629.     bsr    updateLSwin
  4630.  
  4631.     lea    copybuff,a2
  4632.     move.w    #$FF,d7
  4633. clear1    clr.l    (a2)+
  4634.     dbf    d7,clear1
  4635.     
  4636.     move.w    cdepth,d2
  4637.     move.w    d5,d3
  4638.     mulu    bytewid1,d3
  4639.     lea    0(a0,d3.w),a0
  4640.     
  4641. nextplane10    lea    copybuff,a1
  4642.     move.w    brtlx,d1
  4643. nextbyte5    move.w    #7,d3
  4644. nextbit5    move.w    d1,d6
  4645.     move.w    d1,d7
  4646.     not.w    d7
  4647.     and.w    #7,d7
  4648.     and.w    #$FFF8,d6
  4649.     lsr.w    #3,d6
  4650.     btst    d7,0(a0,d6.w)
  4651.     beq    bitclear5
  4652.     
  4653.     bset    d3,(a1)
  4654.     
  4655. bitclear5    add.w    #1,d1
  4656.  
  4657.     cmp.w    brbrx,d1
  4658.     bgt    linedone6
  4659.     
  4660.     sub.w    #1,d3
  4661.     bpl    nextbit5
  4662.     
  4663.     add.w    #1,a1
  4664.     bra    nextbyte5
  4665.  
  4666. linedone6    move.w    iffheight,d0
  4667.     mulu    bytewid1,d0
  4668.     lea    0(a0,d0.w),a0
  4669.     
  4670.     sub.w    #1,d2
  4671.     bne    nextplane10
  4672.     
  4673.     cmp.b    #1,extrablit
  4674.     bne    noblitL6
  4675.     
  4676.     clr.w    store1
  4677.     filewrite    handle1,#store1,#2
  4678.     
  4679. noblitL6    add.l    #1,a1
  4680.     clr.b    (a1)
  4681.     sub.l    #copybuff,a1
  4682.     move.l    a1,d0
  4683.     add.l    #1,d0
  4684.     and.l    #$fffffffe,d0
  4685.     
  4686.     filewrite    handle1,#copybuff,d0
  4687.     
  4688.     cmp.b    #2,extrablit
  4689.     bne    noblitR6
  4690.  
  4691.     clr.w    store1
  4692.     filewrite    handle1,#store1,#2
  4693.     
  4694. noblitR6    move.l    a4,a0
  4695.     add.w    #1,d5
  4696.     cmp.w    brbry,d5
  4697.     ble    nextline12
  4698.     
  4699.     bsr    closeLSwin
  4700.     bsr    closefile
  4701.     bsr    fakebpl
  4702.     bra    nomessage1
  4703.  
  4704. screenmode    lea    menupal,a1
  4705.     move.l    scrpt1,a0
  4706.     lea    sc_ViewPort(a0),a0
  4707.     move.l    #4,d0
  4708.     move.l    gfxbase,a6
  4709.     jsr    _LVOLoadRGB4(a6)
  4710.     
  4711.     move.l    reqtbase,a6
  4712.     move.l    #RT_SCREENMODEREQ,d0
  4713.     sub.l    a0,a0
  4714.     ;lea    sc_tags1,a0
  4715.     jsr    _LVOrtAllocRequestA(a6)
  4716.     move.l    d0,d7
  4717.     beq    noscreq
  4718.     
  4719.     move.l    d7,a1
  4720.     lea    sc_tags3,a0
  4721.     jsr    _LVOrtChangeReqAttrA(a6)
  4722.     
  4723.     move.l    d7,a1
  4724.     lea    wintit,a3
  4725.     lea    sc_tags2,a0
  4726.     jsr    _LVOrtScreenModeRequestA(a6)
  4727.     
  4728.     tst.l    d0
  4729.     beq    noscreq
  4730.     
  4731. screntry    move.l    d7,a0
  4732.     move.l    rtsc_DisplayID(a0),d0
  4733.     move.l    d0,scrvmodes
  4734.     move.l    d0,iffcamg
  4735.  
  4736.     move.w    rtsc_DisplayWidth(a0),scrwid
  4737.     move.w    scrwid,winwidth
  4738.     move.w    scrwid,pagewid
  4739.     move.w    rtsc_DisplayHeight(a0),scrht
  4740.     move.w    scrht,winheight
  4741.     move.w    scrht,pageht
  4742.     sub.w    #22,winheight
  4743.     
  4744.     move.l    d7,a1
  4745.     jsr    _LVOrtFreeRequest(a6)
  4746.     
  4747.     tst.l    winpt1
  4748.     beq    nowin
  4749.     
  4750.     move.l    intuibase,a6
  4751.     move.l    winpt1,a0
  4752.     jsr    _LVOClearMenuStrip(a6)
  4753.     
  4754.     move.l    winpt1,a0
  4755.     jsr    _LVOCloseWindow(a6)
  4756.     clr.l    winpt1
  4757.     
  4758. nowin    tst.l    scrpt1
  4759.     beq    noscr
  4760.     move.l    scrpt1,a0
  4761.     jsr    _LVOCloseScreen(a6)
  4762.     clr.l    scrpt1
  4763.     
  4764. noscr    move.l    intuibase,a6
  4765.     lea    newscreen,a0
  4766.     jsr    _LVOOpenScreen(a6)
  4767.     tst.l    d0
  4768.     beq    noram
  4769.     move.l    d0,scrpt1
  4770.     move.l    d0,scrpt2
  4771.     move.l    d0,scrpt3
  4772.     move.l    d0,scrpt4
  4773.     ;move.l    d0,scrpt5
  4774.     
  4775.     move.w    iffdepth,cdepth
  4776.     move.w    cdepth,d0
  4777.     move.w    #1,d1
  4778.     lea    depthASCII,a0
  4779.     bsr    numtohexasc
  4780.     
  4781.     lea    newwindow,a0
  4782.     move.l    intuibase,a6
  4783.     jsr    _LVOOpenWindow(a6)
  4784.     move.l    d0,winpt1
  4785.     move.l    d0,winpt2
  4786.     move.l    d0,winpt3
  4787.     move.l    d0,winpt4
  4788.     beq    noram
  4789.     
  4790.     move.w    pageht,d0
  4791.     sub.w    #$32,d0
  4792.     lsr.w    #1,d0
  4793.     move.w    d0,loadwiny
  4794.     move.w    pagewid,d0
  4795.     sub.w    #$118,d0
  4796.     lsr.w    #1,d0
  4797.     move.w    d0,loadwinx
  4798.     
  4799.     move.l    winpt1,a0
  4800.     lea    menu1,a1
  4801.     move.l    intuibase,a6
  4802.     jsr    _LVOSetMenuStrip(a6)
  4803.     
  4804.     move.l    winpt1,a0
  4805.     lea    mousept,a1
  4806.     move.w    #15,d0
  4807.     move.w    #15,d1
  4808.     move.w    #-8,d2
  4809.     move.w    #-7,d3
  4810.     jsr    _LVOSetPointer(a6)
  4811.     
  4812.     move.l    winpt1,a1
  4813.     move.l    wd_RPort(a1),a1
  4814.     move.b    #RP_COMPLEMENT,d0
  4815.     move.l    gfxbase,a6
  4816.     jsr    _LVOSetDrMd(a6)
  4817.     
  4818.     move.w    #$FFFF,brtlx
  4819.     move.w    #$FFFF,brtly
  4820.     move.w    #$FFFF,brbrx
  4821.     move.w    #$FFFF,brbry
  4822.     sf    brushon
  4823.     bsr    updatecoords
  4824.     bsr    fakebpl
  4825.     bra    doblit
  4826. noscreq    bsr    fakebpl
  4827.     bra    nomessage1
  4828.  
  4829. filterfunc    move.l    iffcamg,d0
  4830.     move.l    a1,d1
  4831.     
  4832.     and.l    #~MONITOR_ID_MASK,d0
  4833.     and.l    #~MONITOR_ID_MASK,d1
  4834.     
  4835.     move.l    d0,d2
  4836.     move.l    d1,d3
  4837.     and.l    #HAM_KEY,d2
  4838.     and.l    #HAM_KEY,d3
  4839.     cmp.l    d2,d3
  4840.     bne    exclude
  4841.     
  4842.     move.l    d0,d2
  4843.     move.l    d1,d3
  4844.     and.l    #EXTRAHALFBRITE_KEY,d2
  4845.     and.l    #EXTRAHALFBRITE_KEY,d3
  4846.     cmp.l    d2,d3
  4847.     bne    exclude
  4848.     bra    include
  4849.     
  4850. exclude    moveq    #0,d0
  4851.     rts
  4852.     
  4853. include    move.l    #-1,d0
  4854.     rts
  4855.  
  4856. ;----------------------------------------------------------
  4857.  
  4858. drawLSwin    move.l    lswindow,d0
  4859.     tst.l    d0
  4860.     beq    noLSwin00
  4861.     move.l    d0,a1
  4862.     
  4863.     move.l    wd_RPort(a1),a1
  4864.     move.l    #2,d0
  4865.     move.l    gfxbase,a6
  4866.     jsr    _LVOSetAPen(a6)
  4867.     
  4868.     move.l    lswindow,a0
  4869.     move.l    wd_RPort(a0),a0
  4870.     lea    intuiloadtxt,a1
  4871.     move.l    #11,d0
  4872.     move.l    #20,d1
  4873.     move.l    intuibase,a6
  4874.     jsr    _LVOPrintIText(a6)
  4875.     
  4876.     move.l    lswindow,a1
  4877.     move.l    wd_RPort(a1),a1
  4878.     move.l    #11,d0
  4879.     move.l    #30,d1
  4880.     move.l    #269,d2
  4881.     move.l    #40,d3
  4882.     move.l    gfxbase,a6
  4883.     jsr    _LVORectFill(a6)
  4884.     
  4885.     move.l    lswindow,a1
  4886.     move.l    wd_RPort(a1),a1
  4887.     moveq    #0,d0
  4888.     jsr    _LVOSetAPen(a6)
  4889.     
  4890.     move.l    lswindow,a1
  4891.     move.l    wd_RPort(a1),a1
  4892.     move.l    #12,d0
  4893.     move.l    #31,d1
  4894.     move.l    #268,d2
  4895.     move.l    #39,d3
  4896.     jsr    _LVORectFill(a6)
  4897. noLSwin00    rts
  4898.  
  4899. updateLSwin    tst.l    lswindow
  4900.     beq    noLSwin01
  4901.     
  4902.     movem.l    d0-d7/a0-a6,-(sp)
  4903.     
  4904.     move.l    lswindow,a1
  4905.     move.l    wd_RPort(a1),a1
  4906.     move.l    #3,d0
  4907.     move.l    gfxbase,a6
  4908.     jsr    _LVOSetAPen(a6)
  4909.     
  4910.     move.l    lswindow,a1
  4911.     move.l    wd_RPort(a1),a1
  4912.     move.l    #12,d0
  4913.     move.l    #31,d1
  4914.     move.l    #256,d3
  4915.     mulu    lineno,d3
  4916.     divu    maxline,d3
  4917.     
  4918.     and.l    #$FFFF,d3
  4919.     move.l    #268,d2
  4920.     sub.w    d3,d2
  4921.     move.l    #39,d3
  4922.     jsr    _LVORectFill(a6)
  4923.     
  4924.     movem.l    (sp)+,d0-d7/a0-a6
  4925. noLSwin01    rts
  4926.  
  4927. closeLSwin    tst.l    lswindow
  4928.     beq    noLSwin02
  4929.     
  4930.     move.l    intuibase,a6
  4931.     move.l    lswindow,a0
  4932.     jsr    _LVOCloseWindow(a6)
  4933.     clr.l    lswindow
  4934. noLSwin02    rts
  4935.  
  4936. close    tst.l    winpt1
  4937.     beq    nowin1
  4938.     move.l    winpt1,a0
  4939.     move.l    intuibase,a6
  4940.     jsr    _LVOClearMenuStrip(a6)
  4941.     
  4942.     move.l    winpt1,a0
  4943.     jsr    _LVOCloseWindow(a6)
  4944.     clr.l    winpt1
  4945.     
  4946. nowin1    tst.l    scrpt1
  4947.     beq    noscr1
  4948.     move.l    scrpt1,a0
  4949.     move.l    intuibase,a6
  4950.     jsr    _LVOCloseScreen(a6)
  4951.     clr.l    scrpt1
  4952.     
  4953. noscr1    tst.l    pladdr
  4954.     beq    nobpl1
  4955.     move.l    pladdr,a1
  4956.     move.l    plsize,d0
  4957.     move.l    4.w,a6
  4958.     jsr    _LVOFreeMem(a6)
  4959.     clr.l    pladdr
  4960.     
  4961. nobpl1    tst.l    req1
  4962.     beq    noreq1
  4963.     move.l    reqtbase,a6
  4964.     move.l    req1,a1
  4965.     jsr    _LVOrtFreeRequest(a6)
  4966.     clr.l    req1
  4967.     
  4968. noreq1    tst.l    req2
  4969.     beq    noreq2
  4970.     move.l    reqtbase,a6
  4971.     move.l    req2,a1
  4972.     jsr    _LVOrtFreeRequest(a6)
  4973.     clr.l    req2
  4974.     
  4975. noreq2    tst.l    dtbase
  4976.     beq    nodtlib
  4977.     move.l    dtbase,a1
  4978.     move.l    4.w,a6
  4979.     jsr    _LVOCloseLibrary(a6)
  4980.     clr.l    dtbase
  4981.     
  4982. nodtlib    tst.l    reqtbase
  4983.     beq    norqtlib
  4984.     move.l    reqtbase,a1
  4985.     move.l    4.w,a6
  4986.     jsr    _LVOCloseLibrary(a6)
  4987.     clr.l    reqtbase
  4988.     
  4989. norqtlib    tst.l    gadbase
  4990.     beq    nogadtlib
  4991.     move.l    gadbase,a1
  4992.     move.l    4.w,a6
  4993.     jsr    _LVOCloseLibrary(a6)
  4994.         clr.l    gadbase
  4995.     
  4996. nogadtlib    tst.l    gfx39base
  4997.     beq    nogfx39lib
  4998.     move.l    gfx39base,a1
  4999.     move.l    4.w,a6
  5000.     jsr    _LVOCloseLibrary(a6)
  5001.     clr.l    gfx39base
  5002.     
  5003. nogfx39lib    tst.l    gfxbase
  5004.     beq    nogfxlib
  5005.     move.l    gfxbase,a1
  5006.     move.l    4.w,a6
  5007.     jsr    _LVOCloseLibrary(a6)
  5008.     clr.l    gfxbase
  5009.     
  5010. nogfxlib    tst.l    intuibase
  5011.     beq    nointlib
  5012.     move.l    intuibase,a1
  5013.     move.l    4.w,a6
  5014.     jsr    _LVOCloseLibrary(a6)
  5015.     clr.l    intuibase
  5016.     
  5017. nointlib    move.l    dosbase,a1
  5018.     move.l    4.w,a6
  5019.     jsr    _LVOCloseLibrary(a6)
  5020.     clr.l    dosbase
  5021.     
  5022.     moveq    #0,d0
  5023.     rts
  5024.  
  5025. coordchange    add.b    #1,coordtype
  5026.     cmp.b    #3,coordtype
  5027.     bne    notwrapct
  5028.     move.b    #0,coordtype
  5029. notwrapct    rts
  5030.  
  5031. decbpl    cmp.w    #1,cdepth
  5032.     beq    minbpl
  5033.     
  5034.     move.l    iffcamg,d0
  5035.     and.l    #$880,d0
  5036.     bne    minbpl
  5037.     
  5038.     sub.w    #1,cdepth
  5039.     bsr    fakebpl
  5040.     move.w    cdepth,d0
  5041.     move.w    #1,d1
  5042.     lea    depthASCII,a0
  5043.     bsr    numtohexasc
  5044.     bsr    writecoords
  5045. minbpl    rts
  5046.  
  5047. incbpl    move.w    cdepth,d0
  5048.     cmp.w    iffdepth,d0
  5049.     beq    maxbpl
  5050.     
  5051.     move.l    iffcamg,d0
  5052.     and.l    #$880,d0
  5053.     bne    maxbpl
  5054.     add.w    #1,cdepth
  5055.     bsr    fakebpl
  5056.     move.w    cdepth,d0
  5057.     move.w    #1,d1
  5058.     lea    depthASCII,a0
  5059.     bsr    numtohexasc
  5060.     bsr    writecoords
  5061. maxbpl    rts
  5062.  
  5063. fakebpl    tst.l    gfx39base
  5064.     beq    nogfx39b
  5065.     
  5066.     move.l    gfx39base,a6
  5067.     move.l    #1,d0
  5068.     move.w    iffdepth,d1
  5069.     lsl.l    d1,d0
  5070.     move.l    #1,d2
  5071.     move.w    cdepth,d3
  5072.     lsl.l    d3,d2
  5073.     divu    d2,d0
  5074.     move.w    d0,d6
  5075.     sub.w    #1,d6
  5076.     lea    pal32,a1
  5077.     move.l    #1,d0
  5078.     move.w    iffdepth,d1
  5079.     lsl.l    d1,d0
  5080.     move.w    d0,(a1)+
  5081.     clr.w    (a1)+
  5082.     
  5083. nextlot    move.l    #1,d7
  5084.     move.w    cdepth,d1
  5085.     lsl.l    d1,d7
  5086.     sub.w    #1,d7
  5087.     lea    palstore1,a0
  5088.     
  5089.     moveq    #0,d1
  5090.     move.l    #$7fff,d2
  5091.     clr.b    d4
  5092.     
  5093. copycols    moveq    #0,d3
  5094.     move.b    (a0)+,d0
  5095.     and.l    #$FF,d0
  5096.     add.l    d0,d3
  5097.     swap    d0
  5098.     lsl.l    #8,d0
  5099.     move.l    d0,(a1)+
  5100.     move.b    (a0)+,d0
  5101.     and.l    #$FF,d0
  5102.     add.l    d0,d3
  5103.     swap    d0
  5104.     lsl.l    #8,d0
  5105.     move.l    d0,(a1)+
  5106.     move.b    (a0)+,d0
  5107.     and.l    #$FF,d0
  5108.     add.l    d0,d3
  5109.     swap    d0
  5110.     lsl.l    #8,d0
  5111.     
  5112.     cmp.w    d3,d1
  5113.     bge    notlight3
  5114.     
  5115.     move.w    d3,d1
  5116.     move.b    d4,lightest
  5117.     
  5118. notlight3    cmp.w    d3,d2
  5119.     ble    notdark3
  5120.     
  5121.     move.w    d3,d2
  5122.     move.b    d4,darkest
  5123.  
  5124. notdark3    move.l    d0,(a1)+
  5125.     addq.b    #1,d4
  5126.     dbf    d7,copycols
  5127.     dbf    d6,nextlot
  5128.     
  5129.     clr.l    (a1)+
  5130.     lea    pal32,a1
  5131.     move.l    scrpt1,a0
  5132.     lea    sc_ViewPort(a0),a0
  5133.     jsr    _LVOLoadRGB32(a6)
  5134.     rts
  5135.  
  5136. nogfx39b    move.l    gfxbase,a6
  5137.     moveq    #1,d0
  5138.     move.w    iffdepth,d1
  5139.     lsl.l    d1,d0
  5140.     move.w    d0,d7
  5141.     subq.w    #1,d7
  5142.     lea    palstore1,a0
  5143.     lea    palstore2,a1
  5144.     
  5145. copypal2    moveq    #0,d2
  5146.     move.b    (a0)+,d1
  5147.     and.b    #$F0,d1
  5148.     lsr.b    #4,d1
  5149.     or.b    d1,d2
  5150.     lsl.w    #4,d2
  5151.     move.b    (a0)+,d1
  5152.     and.b    #$F0,d1
  5153.     lsr.b    #4,d1
  5154.     or.b    d1,d2
  5155.     lsl.w    #4,d2
  5156.     move.b    (a0)+,d1
  5157.     and.b    #$F0,d1
  5158.     lsr.b    #4,d1
  5159.     or.b    d1,d2
  5160.     move.w    d2,(a1)+
  5161.     dbf    d7,copypal2
  5162.     
  5163.     lea    palstore2,a1
  5164.     move.l    scrpt1,a0
  5165.     lea    sc_ViewPort(a0),a0
  5166.     jsr    _LVOLoadRGB4(a6)
  5167.     rts
  5168.  
  5169. writecoords    move.l    winpt1,a1
  5170.     move.l    wd_RPort(a1),a1
  5171.     move.b    #RP_JAM2,d0
  5172.     move.l    gfxbase,a6
  5173.     jsr    _LVOSetDrMd(a6)
  5174.     
  5175.     move.l    scrpt1,a1
  5176.     lea    sc_RastPort(a1),a1
  5177.     moveq    #0,d0
  5178.     move.b    darkest,d0
  5179.     jsr    _LVOSetAPen(a6)
  5180.     
  5181.     move.l    scrpt1,a1
  5182.     lea    sc_RastPort(a1),a1
  5183.     move.l    #320,d0
  5184.     move.l    #12,d1
  5185.     move.w    pagewid,d2
  5186.     move.l    #19,d3
  5187.     jsr    _LVORectFill(a6)
  5188.     
  5189.     move.l    winpt1,a1
  5190.     move.l    wd_RPort(a1),a1
  5191.     move.b    #RP_COMPLEMENT,d0
  5192.     jsr    _LVOSetDrMd(a6)
  5193.     
  5194.     
  5195.     lea    statmod,a0
  5196.     lea    coordtxt,a1
  5197.     tst.b    coordtype
  5198.     beq    coordstype
  5199.     
  5200.     lea    addrtxt,a1
  5201. coordstype    move.b    (a1)+,(a0)+
  5202.     bne    coordstype
  5203.         
  5204.     move.b    lightest,statbfg
  5205.     move.b    darkest,statbbg
  5206.     move.l    scrpt1,a0
  5207.     lea    sc_RastPort(a0),a0
  5208.     lea    statbartxt,a1
  5209.     clr.w    d0
  5210.     move.w    #12,d1
  5211.     move.l    intuibase,a6
  5212.     jsr    _LVOPrintIText(a6)
  5213.     rts
  5214.  
  5215. numtoascii2    add.l    #6,a0
  5216.     lea    numbers,a1
  5217.     move.w    #6-1,d7
  5218.     bra    convert
  5219.  
  5220. numtoascii    and.l    #$FFFF,d0
  5221.     tst.w    d0
  5222.     bpl    notminus
  5223.     
  5224.     clr.w    d0
  5225.     
  5226. notminus    add.l    #4,a0
  5227.     lea    numbers,a1
  5228.     move.w    #4-1,d7
  5229. convert    divs    #10,d0
  5230.     swap    d0
  5231.     move.b    0(a1,d0.w),-(a0)
  5232.     clr.w    d0
  5233.     swap    d0
  5234.     dbf    d7,convert
  5235.     rts
  5236.  
  5237. numbers    dc.b    '0123456789'
  5238.  
  5239. numtohexasc    move.l    d7,-(sp)
  5240.     and.l    #$FFFF,d0
  5241.     and.l    #$FFFF,d1
  5242.     add.l    d1,a0
  5243.     lea    hexnums,a1
  5244.     move.w    d1,d7
  5245.     sub.w    #1,d7
  5246. convert2    divs    #$10,d0
  5247.     swap    d0
  5248.     move.b    0(a1,d0.w),-(a0)
  5249.     clr.w    d0
  5250.     swap    d0
  5251.     dbf    d7,convert2
  5252.     
  5253.     move.l    (sp)+,d7
  5254.     rts
  5255.  
  5256. hexnums    dc.b    '0123456789ABCDEF'
  5257.  
  5258. **************************************************************** 
  5259. *  Copyright 1988 by CREATIVE FOCUS.  This code is freely 
  5260. *  distributable as long as this notice is retained and no 
  5261. *  other conditions are imposed upon its redistribution. 
  5262. *  APACK.ASM --  
  5263. *  A fully compatible replacement for Electronic Arts' PACKER.C 
  5264. *  routine.  Converts data according to the IFF ILBM cmpByteRun1 
  5265. *  compression protocol: 
  5266. *     control bytes: 
  5267. *        n =  0.. 127:   followed by n+1 bytes of data; 
  5268. *        n = -1..-127:   followed by byte to be repeated -n+1 times; 
  5269. *        n =     -128:   don't do no nada. 
  5270. *     calling format: 
  5271. *        long packrow(from, too, amt) 
  5272. *           char **from, /* pointer to source data pointer */ 
  5273. *                **too;  /* pointer to destination data pointer */ 
  5274. *           long amt;    /* number of bytes to compress */ 
  5275. *        return(number of bytes written to destination); 
  5276. *     effects: 
  5277. *         *from = *from + amt, and *too = *too + return; 
  5278. *         return is "smart," that is, not greater than 
  5279. *         MaxPackedSize = amt + ((amt+127) >> 7). 
  5280. *     By commenting out CHECK (below) you disable checking for runs 
  5281. *     exceeding 128 bytes.  That CHECK is not needed if you are sure 
  5282. *     the amt to be compressed is always 128 or less. 
  5283. *  !!! DISCLAIMER !!!  You use this code entirely at your own 
  5284. *  risk.  I don't warrantee its fitness for any purpose.  I 
  5285. *  can't even guarantee the accuracy of anything I've said 
  5286. *  about it, though I've tried my damndest to get it right. 
  5287. *  I may, in fact, be completely out of my tiny little mind :-). 
  5288. *  That being said, I can be reached for questions, comments, 
  5289. *  or concerns at: 
  5290. *        Dr. Gerald Hull 
  5291. *        CREATIVE FOCUS 
  5292. *        12 White Street 
  5293. *        Binghamton, N.Y.  13901 
  5294. *        (607) 648-4082 
  5295. *        bix:    ghull 
  5296. *        PLink:  DRJERRY 
  5297. *************************************************************** 
  5298. FRM   equ   8                 input line address 
  5299. TOO   equ   12                output line address 
  5300. AMT   equ   16                length of input line 
  5301.  
  5302. MAX   equ   128               maximum encodable output run 
  5303. CHECK equ   1                 turns on maximum row checking 
  5304.  
  5305. packrow 
  5306.  
  5307.  
  5308. ***************     CASE 0:   GRAB PARAMS & INITIALIZE 
  5309. CAS0 
  5310.       link     a6,#0 
  5311.       movem.l  d2/d3/a2/a3/a4,-(a7) 
  5312.       movea.l  FRM(a6),a2 
  5313.       movea.l  (a2),a2        a2 = *from 
  5314.       movea.l  a2,a3          a3 = a2 
  5315.       movea.l  a3,a1 
  5316.       adda.l   AMT(a6),a1     a1 = a2 + amt 
  5317.       movea.l  TOO(a6),a4 
  5318.       movea.l  (a4),a4        a4 = *too 
  5319.  
  5320.  
  5321. ***************     CASE 1:   LITERAL RUN 
  5322. CAS1 
  5323.       movea.l  a3,a0          adjust a0 (no replicates yet!) 
  5324.       move.b   (a3)+,d3       grab character 
  5325.       cmpa.l   a3,a1          if input is finished 
  5326.       beq.s    CAS5              branch to case 5 
  5327.  
  5328.       ifd      CHECK 
  5329.       move.l   a3,d1 
  5330.       sub.l    a2,d1 
  5331.       cmpi     #MAX,d1        if run has reached MAX 
  5332.       beq.s    CAS6              branch to case 6 
  5333.       endc 
  5334.  
  5335.       cmp.b    (a3),d3        if next character != CH 
  5336.       bne.s    CAS1              stay in case 1 
  5337.  
  5338.       move.b    (a3)+,d3
  5339.       cmp.l    a3,a1
  5340.       beq.b    CAS7
  5341.  
  5342.       move.l    a3,d1
  5343.       sub.l    a2,d1
  5344.       cmp.w    #MAX,d1
  5345.       beq.b    CAS6
  5346.  
  5347.       cmp.b    (a3),d3
  5348.       bne.b    CAS1
  5349.   
  5350. ***************     CASE 3:   REPLICATE RUN 
  5351. CAS3 
  5352.       move.b   (a3)+,d3       grab character 
  5353.       cmpa.l   a3,a1          if input is finished 
  5354.       beq.s    CAS7              branch to case 7 
  5355.  
  5356.       ifd      CHECK 
  5357.       move.l   a3,d1 
  5358.       sub.l    a0,d1 
  5359.       cmpi     #MAX,d1        if run has reached MAX 
  5360.       beq.s    CAS4              branch to case 4 
  5361.       endc 
  5362.  
  5363.       cmp.b    (a3),d3        if next character = CH 
  5364.       beq.s    CAS3              stay in case 3 
  5365.  
  5366. *                             else fall into case 4 
  5367.  
  5368.  
  5369. ***************     CASE 4:   LIT AND/OR REP DUMP & CONTINUE 
  5370. CAS4 
  5371.       move.l   a0,d2 
  5372.       sub.l    a2,d2          d2 = a0 - a2 
  5373. *                             if no literal run 
  5374.       beq.s    C41               branch to replicate run 
  5375.  
  5376.       subq     #1,d2          d2 = d2 - 1 
  5377.       move.b   d2,(a4)+       output literal control byte 
  5378.  
  5379. C40   move.b   (a2)+,(a4)+    output literal run 
  5380.       dbra     d2,C40 
  5381.  
  5382. C41   move.l   a0,d2 
  5383.       sub.l    a3,d2          d2 = a0 - a3 (negative result!) 
  5384.       addq     #1,d2          d2 = d2 + 1 
  5385.       move.b   d2,(a4)+       output replicate control byte 
  5386.       move.b   d3,(a4)+       output repeated character 
  5387.       movea.l  a3,a2          reset a2 
  5388.       bra.s    CAS1           branch to case 1 (not done) 
  5389.  
  5390.  
  5391. ***************     CASE 5:   LITERAL DUMP & QUIT 
  5392. CAS5 
  5393.       move.l   a3,d2 
  5394.       sub.l    a2,d2          d2 = a3 - a2 (positive result > 0) 
  5395.       subq     #1,d2          d2 = d2 - 1 
  5396.       move.b   d2,(a4)+       output literal control byte 
  5397.  
  5398. C50   move.b   (a2)+,(a4)+    output literal run 
  5399.       dbra     d2,C50 
  5400.  
  5401.       bra.s    CAS8           branch to case 8 (done) 
  5402.  
  5403.  
  5404.       ifd      CHECK 
  5405.  
  5406. ***************     CASE 6:   LITERAL DUMP & CONTINUE 
  5407. CAS6 
  5408.       move.l   a3,d2 
  5409.       sub.l    a2,d2          d2 = a3 - a2 (positive result > 0) 
  5410.       subq     #1,d2          d2 = d2 - 1 
  5411.       move.b   d2,(a4)+       output literal control byte 
  5412.  
  5413. C60   move.b   (a2)+,(a4)+    output literal run 
  5414.       dbra     d2,C60 
  5415.  
  5416.       bra      CAS1           branch to case 1 (not done) 
  5417.  
  5418.       endc 
  5419.  
  5420.  
  5421. ***************     CASE 7:   LIT AND/OR REP DUMP & FINISH 
  5422. CAS7 
  5423.       move.l   a0,d2 
  5424.       sub.l    a2,d2          d2 = a0 - a2 (positive result > 0) 
  5425. *                             if no literal run 
  5426.       beq.s    C71               branch to replicate run 
  5427.  
  5428.       subq     #1,d2          d2 = d2 - 1 
  5429.       move.b   d2,(a4)+       output literal control byte 
  5430.  
  5431. C70   move.b   (a2)+,(a4)+    output literal run 
  5432.       dbra     d2,C70 
  5433.  
  5434. C71   move.l   a0,d2 
  5435.       sub.l    a3,d2          d2 = a0 - a3 (negative result) 
  5436.       addq     #1,d2          d2 = d2 + 1 
  5437.       move.b   d2,(a4)+       output replicate control byte 
  5438.       move.b   d3,(a4)+       output repeated character 
  5439.  
  5440. *                             fall into case 8 
  5441.  
  5442.  
  5443. ***************     CASE 8:   ADJUST PARAMS & RETURN VALUE 
  5444. CAS8 
  5445.       movea.l  FRM(a6),a0     a0 = **from 
  5446.       move.l   a3,(a0)        *from = *from + amt 
  5447.       movea.l  TOO(a6),a0     a0 = **too 
  5448.  
  5449.       move.l   a4,d0 
  5450.       sub.l    (a0),d0      return = a4 - *too  
  5451.  
  5452.       move.l   a4,(a0)       *too = *too + return 
  5453.       movem.l  (a7)+,d2/d3/a2/a3/a4 
  5454.       UNLK     a6
  5455.       rts
  5456.  
  5457.  
  5458. nodos    move.l    #-1,d0
  5459.     rts
  5460.  
  5461. nogfx    move.l    dosbase,a6
  5462.     move.l    stdout,d1
  5463.     move.l    #nogfxtxt,d2
  5464.     move.l    #nogfxend-nogfxtxt,d3
  5465.     jsr    _LVOWrite(a6)
  5466.     bra    close
  5467.  
  5468. nointui    move.l    dosbase,a6
  5469.     move.l    stdout,d1
  5470.     move.l    #nointuitxt,d2
  5471.     move.l    #nointuiend-nointuitxt,d3
  5472.     jsr    _LVOWrite(a6)
  5473.     bra    close
  5474.  
  5475. nogadt    move.l    dosbase,a6
  5476.     move.l    stdout,d1
  5477.     move.l    #nogadttxt,d2
  5478.     move.l    #nogadtend-nogadttxt,d3
  5479.     jsr    _LVOWrite(a6)
  5480.     bra    close
  5481.  
  5482. noreqt    move.l    dosbase,a6
  5483.     move.l    stdout,d1
  5484.     move.l    #noreqttxt,d2
  5485.     move.l    #noreqtend-noreqttxt,d3
  5486.     jsr    _LVOWrite(a6)
  5487.     bra    close
  5488.  
  5489. noreqa1    move.l    dosbase,a6
  5490.     move.l    stdout,d1
  5491.     move.l    #noreqatxt,d2
  5492.     move.l    #noreqaend-noreqatxt,d3
  5493.     jsr    _LVOWrite(a6)
  5494.     bra    close
  5495.  
  5496. noreqa2    move.l    dosbase,a6
  5497.     move.l    stdout,d1
  5498.     move.l    #noreqatxt,d2
  5499.     move.l    #noreqaend-noreqatxt,d3
  5500.     jsr    _LVOWrite(a6)
  5501.     bra    close
  5502.  
  5503. noram    tst.l    dtobject
  5504.     beq    nodtobj1
  5505.     move.l    winpt1,a0
  5506.     move.l    dtobject,a1
  5507.     jsr    _LVORemoveDTObject(a6)
  5508.     
  5509.     move.l    dtobject,a0
  5510.     jsr    _LVODisposeDTObject(a6)
  5511.  
  5512. nodtobj1    move.l    dosbase,a6
  5513.     move.l    stdout,d1
  5514.     move.l    #noscreentxt,d2
  5515.     move.l    #noscreenend-noscreentxt,d3
  5516.     jsr    _LVOWrite(a6)
  5517.     bra    close
  5518.  
  5519. noks2    move.l    dosbase,a6
  5520.     move.l    stdout,d1
  5521.     move.l    #noks2txt,d2
  5522.     move.l    #noks2end-noks2txt,d3
  5523.     jsr    _LVOWrite(a6)
  5524.     bra    close
  5525.  
  5526.     SECTION    maindata,DATA
  5527.  
  5528.     dc.b    '$VER:IFFMaster Pro v0.99n (25/09/94)',0
  5529.     
  5530.     even
  5531. newloadwin
  5532. loadwinx    dc.w    0        ;x position
  5533. loadwiny    dc.w    11        ;y position
  5534.     dc.w    280        ;width
  5535.     dc.w    50        ;height
  5536.     dc.b    0        ;block pen
  5537.     dc.b    1        ;detail pen
  5538.     dc.l    0        ;easy IDCMP
  5539.     dc.l    (WINDOWDRAG|WINDOWDEPTH|SIMPLE_REFRESH|ACTIVATE);flags
  5540.     dc.l    0        ;gadgets
  5541.     dc.l    0        ;checkmark
  5542. windowtitle    dc.l    lwintitle        ;title
  5543. scrpt3    dc.l    0        ;screen ptr
  5544.     dc.l    0        ;bitmap
  5545.     dc.w    0        ;min width
  5546.     dc.w    0        ;min height
  5547.     dc.w    0        ;max width
  5548.     dc.w    0        ;max height
  5549.     dc.w    CUSTOMSCREEN    ;type
  5550.  
  5551. newwindow    dc.w    0        ;x position
  5552.     dc.w    22        ;y position
  5553. winwidth    dc.w    640        ;width
  5554. winheight    dc.w    234        ;height
  5555.     dc.b    1        ;block pen
  5556.     dc.b    2        ;detail pen
  5557.     dc.l    (MOUSEBUTTONS|MOUSEMOVE|MENUPICK|MENUVERIFY|RAWKEY);easy IDCMP
  5558.     dc.l    (SMART_REFRESH|ACTIVATE|REPORTMOUSE|BORDERLESS|GIMMEZEROZERO|BACKDROP|WFLG_NEWLOOKMENUS);flags
  5559.     dc.l    0        ;gadgets
  5560.     dc.l    0        ;checkmark
  5561.     dc.l    0        ;title
  5562. scrpt2    dc.l    0        ;screen ptr    
  5563.     dc.l    0        ;bitmap
  5564.     dc.w    0        ;min width
  5565.     dc.w    0        ;min height
  5566.     dc.w    0        ;max width
  5567.     dc.w    0        ;max height
  5568.     dc.w    CUSTOMSCREEN    ;type
  5569.  
  5570. newscreen    dc.w    0        ;left edge
  5571.     dc.w    0        ;top edge
  5572. scrwid    dc.w    640        ;width
  5573. scrht    dc.w    256        ;height
  5574. scrdepth    dc.w    2        ;depth
  5575.     dc.b    0        ;detail pen
  5576.     dc.b    1        ;block pen
  5577.     dc.w    V_HIRES        ;view modes
  5578.     dc.w    CUSTOMSCREEN|NS_EXTENDED;type
  5579.     dc.l    0        ;font
  5580.     dc.l    scrtitle        ;title
  5581.     dc.l    0        ;gadgets
  5582.     dc.l    0        ;custom bitmap
  5583.     dc.l    scrtags        ;ens extension
  5584.  
  5585. scrtags    dc.l    SA_DisplayID
  5586. scrvmodes    dc.l    HIRES_KEY
  5587.     dc.l    SA_Pens
  5588.     dc.l    pensdata
  5589.     dc.l    TAG_DONE
  5590.  
  5591. pensdata    dc.w    -1
  5592.  
  5593. bitmap
  5594. bytesperrow    dc.w    80        ;bytes per row
  5595. height2    dc.w    256        ;rows
  5596.     dc.b    0        ;flags
  5597. scdepth    dc.b    2        ;depth
  5598.     dc.w    0        ;pad
  5599. bplptr    dc.l    0        ;planes ptrs 0 - 7
  5600.     dc.l    0
  5601.     dc.l    0
  5602.     dc.l    0
  5603.     dc.l    0
  5604.     dc.l    0
  5605.     dc.l    0
  5606.     dc.l    0
  5607.  
  5608. ;saveprefswin
  5609. ;spwinx    dc.w    0        ;x position
  5610. ;spwiny    dc.w    0        ;y position
  5611. ;    dc.w    200        ;width
  5612. ;    dc.w    200        ;height
  5613. ;    dc.b    1        ;block pen
  5614. ;    dc.b    2        ;detail pen
  5615. ;    dc.l    (MOUSEBUTTONS|MOUSEMOVE|MENUPICK|MENUVERIFY|RAWKEY);easy IDCMP
  5616. ;    dc.l    (SMART_REFRESH|ACTIVATE|WINDOWDRAG);flags
  5617. ;spwingads    dc.l    0        ;gadgets
  5618. ;    dc.l    0        ;checkmark
  5619. ;    dc.l    0        ;title
  5620. ;scrpt5    dc.l    0        ;screen ptr    
  5621. ;    dc.l    0        ;bitmap
  5622. ;    dc.w    0        ;min width
  5623. ;    dc.w    0        ;min height
  5624. ;    dc.w    0        ;max width
  5625. ;    dc.w    0        ;max height
  5626. ;    dc.w    CUSTOMSCREEN    ;type
  5627. ;
  5628. newprefswin    dc.w    0        ;x position
  5629.     dc.w    0        ;y position
  5630.     dc.w    640        ;width
  5631.     dc.w    200        ;height
  5632.     dc.b    1        ;detail pen
  5633.     dc.b    2        ;block pen
  5634.     dc.l    (GADGETUP|CLOSEWINDOW)    ;easy IDCMP
  5635.     dc.l    (WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE|SMART_REFRESH|ACTIVATE)    ;flags
  5636.     dc.l    prefsgad1        ;gadgets
  5637.     dc.l    0        ;checkmark
  5638.     dc.l    prefstitle        ;title
  5639.     dc.l    0        ;screen
  5640.     dc.l    0        ;bitmap
  5641.     dc.w    0        ;min width
  5642.     dc.w    0        ;min height
  5643.     dc.w    0        ;max width
  5644.     dc.w    0        ;max height
  5645.     dc.w    WBENCHSCREEN    ;type
  5646.  
  5647. keytable    dc.w    ALTLT
  5648.     dc.l    altkey
  5649.     dc.w    ALTLT+$80
  5650.     dc.l    altkey
  5651.     dc.w    ALTRT
  5652.     dc.l    altkey
  5653.     dc.w    ALTRT+$80
  5654.     dc.l    altkey
  5655.     dc.w    CTRL
  5656.     dc.l    ctrlkey
  5657.     dc.w    CTRL+$80
  5658.     dc.l    ctrlkey
  5659.     dc.w    CSRLT
  5660.     dc.l    scrolllt
  5661.     dc.w    CSRRT
  5662.     dc.l    scrollrt
  5663.     dc.w    CSRUP
  5664.     dc.l    scrollup
  5665.     dc.w    CSRDN
  5666.     dc.l    scrolldn
  5667.     dc.w    B
  5668.     dc.l    initbrush
  5669.     dc.w    P
  5670.     dc.l    setpalette
  5671.     dc.w    MINUS
  5672.     dc.l    decbpl
  5673.     dc.w    EQUALS
  5674.     dc.l    incbpl
  5675.     dc.w    SPACE
  5676.     dc.l    coordchange
  5677.     dc.w    $FFFF
  5678.     dc.l    $FFFFFFFF
  5679.  
  5680. prefstable    dc.l    prefsgad1
  5681.     dc.l    prefsbplmeth
  5682.     dc.l    prefsgad2
  5683.     dc.l    prefspalinfo
  5684.     dc.l    prefsgad3
  5685.     dc.l    prefspaltype
  5686.     dc.l    prefsgad4
  5687.     dc.l    prefspalmeth
  5688.     dc.l    prefsgad5
  5689.     dc.l    prefssprmeth
  5690.     dc.l    prefsgad6
  5691.     dc.l    prefssprctrl
  5692.     dc.l    prefsgad7
  5693.     dc.l    prefssprdepth
  5694.     dc.l    prefsgad8
  5695.     dc.l    prefsextrablit
  5696.     dc.l    prefsgad9
  5697.     dc.l    prefscomp
  5698.     dc.l    prefsgad11
  5699.     dc.l    undoprefs
  5700.     dc.l    prefsgad13
  5701.     dc.l    prefsquit
  5702.     dc.l    prefsgad14
  5703.     dc.l    prefssave
  5704.     dc.l    0
  5705.     dc.l    0
  5706.  
  5707. prefsgad1    dc.l    prefsgad2        ;next gadget
  5708.     dc.w    4        ;left edge
  5709.     dc.w    30        ;top edge
  5710.     dc.w    632        ;width
  5711.     dc.w    12        ;height
  5712.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5713.     dc.w    GACT_RELVERIFY    ;activation
  5714.     dc.w    GTYP_BOOLGADGET    ;type
  5715.     dc.l    pgad1a        ;gadget render
  5716.     dc.l    0        ;select render
  5717.     dc.l    pgadtxt1        ;gadget text
  5718.     dc.l    0        ;mutual exclude
  5719.     dc.l    0        ;special info
  5720.     dc.w    0        ;gadget id
  5721.     dc.l    0        ;user data ptr
  5722.  
  5723. prefsgad2    dc.l    prefsgad3        ;next gadget
  5724.     dc.w    4        ;left edge
  5725.     dc.w    42        ;top edge
  5726.     dc.w    632        ;width
  5727.     dc.w    12        ;height
  5728.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5729.     dc.w    GACT_RELVERIFY    ;activation
  5730.     dc.w    GTYP_BOOLGADGET    ;type
  5731.     dc.l    pgad1a        ;gadget render
  5732.     dc.l    0        ;select render
  5733.     dc.l    pgadtxt2        ;gadget text
  5734.     dc.l    0        ;mutual exclude
  5735.     dc.l    0        ;special info
  5736.     dc.w    0        ;gadget id
  5737.     dc.l    0        ;use data ptr
  5738.  
  5739. prefsgad3    dc.l    prefsgad4        ;next gadget
  5740.     dc.w    4        ;left edge
  5741.     dc.w    54        ;top edge
  5742.     dc.w    632        ;width
  5743.     dc.w    12        ;height
  5744.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5745.     dc.w    GACT_RELVERIFY    ;activation
  5746.     dc.w    GTYP_BOOLGADGET    ;type
  5747.     dc.l    pgad1a        ;select render
  5748.     dc.l    0        ;gadget render
  5749.     dc.l    pgadtxt3        ;gadget text
  5750.     dc.l    0        ;mutual exclude
  5751.     dc.l    0        ;special info
  5752.     dc.w    0        ;gadget id
  5753.     dc.l    0        ;use data ptr
  5754.  
  5755. prefsgad4    dc.l    prefsgad5        ;next gadget
  5756.     dc.w    4        ;left edge
  5757.     dc.w    66        ;top edge
  5758.     dc.w    632        ;width
  5759.     dc.w    12        ;height
  5760.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5761.     dc.w    GACT_RELVERIFY    ;activation
  5762.     dc.w    GTYP_BOOLGADGET    ;type
  5763.     dc.l    pgad1a        ;select render
  5764.     dc.l    0        ;gadget render
  5765.     dc.l    pgadtxt4        ;gadget text
  5766.     dc.l    0        ;mutual exclude
  5767.     dc.l    0        ;special info
  5768.     dc.w    0        ;gadget id
  5769.     dc.l    0        ;use data ptr
  5770.     
  5771. prefsgad5    dc.l    prefsgad6        ;next gadget
  5772.     dc.w    4        ;left edge
  5773.     dc.w    78        ;top edge
  5774.     dc.w    632        ;width
  5775.     dc.w    12        ;height
  5776.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5777.     dc.w    GACT_RELVERIFY    ;activation
  5778.     dc.w    GTYP_BOOLGADGET    ;type
  5779.     dc.l    pgad1a        ;select render
  5780.     dc.l    0        ;gadget render
  5781.     dc.l    pgadtxt5        ;gadget text
  5782.     dc.l    0        ;mutual exclude
  5783.     dc.l    0        ;special info
  5784.     dc.w    0        ;gadget id
  5785.     dc.l    0        ;use data ptr
  5786.  
  5787. prefsgad6    dc.l    prefsgad7        ;next gadget
  5788.     dc.w    4        ;left edge
  5789.     dc.w    90        ;top edge
  5790.     dc.w    632        ;width
  5791.     dc.w    12        ;height
  5792.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5793.     dc.w    GACT_RELVERIFY    ;activation
  5794.     dc.w    GTYP_BOOLGADGET    ;type
  5795.     dc.l    pgad1a        ;select render
  5796.     dc.l    0        ;gadget render
  5797.     dc.l    pgadtxt6        ;gadget text
  5798.     dc.l    0        ;mutual exclude
  5799.     dc.l    0        ;special info
  5800.     dc.w    0        ;gadget id
  5801.     dc.l    0        ;use data ptr
  5802.  
  5803. prefsgad7    dc.l    prefsgad8        ;next gadget
  5804.     dc.w    4        ;left edge
  5805.     dc.w    102        ;top edge
  5806.     dc.w    632        ;width
  5807.     dc.w    12
  5808.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5809.     dc.w    GACT_RELVERIFY    ;activation
  5810.     dc.w    GTYP_BOOLGADGET    ;type
  5811.     dc.l    pgad1a        ;select render
  5812.     dc.l    0        ;gadget render
  5813.     dc.l    pgadtxt7        ;gadget text
  5814.     dc.l    0        ;mutual exclude
  5815.     dc.l    0        ;special info
  5816.     dc.w    0        ;gadget id
  5817.     dc.l    0        ;use data ptr
  5818.  
  5819. prefsgad8    dc.l    prefsgad9        ;next gadget
  5820.     dc.w    4        ;left edge
  5821.     dc.w    114        ;top edge
  5822.     dc.w    632        ;width
  5823.     dc.w    12        ;height
  5824.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5825.     dc.w    GACT_RELVERIFY    ;activation
  5826.     dc.w    GTYP_BOOLGADGET    ;type
  5827.     dc.l    pgad1a        ;select render
  5828.     dc.l    0        ;gadget render
  5829.     dc.l    pgadtxt8        ;gadget text
  5830.     dc.l    0        ;mutual exclude
  5831.     dc.l    0        ;special info
  5832.     dc.w    0        ;gadget id
  5833.     dc.l    0        ;use data ptr
  5834.  
  5835. prefsgad9    dc.l    prefsgad10        ;next gadget
  5836.     dc.w    4        ;left edge
  5837.     dc.w    126        ;top edge
  5838.     dc.w    632        ;width
  5839.     dc.w    12        ;height
  5840.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5841.     dc.w    GACT_RELVERIFY    ;activation
  5842.     dc.w    GTYP_BOOLGADGET    ;type
  5843.     dc.l    pgad1a        ;select render
  5844.     dc.l    0        ;gadget render
  5845.     dc.l    pgadtxt9        ;gadget text
  5846.     dc.l    0        ;mutual exclude
  5847.     dc.l    0        ;special info
  5848.     dc.w    0        ;gadget id
  5849.     dc.l    0        ;use data ptr
  5850.  
  5851. prefsgad10    dc.l    prefsgad11        ;next gadget
  5852.     dc.w    4        ;left edge
  5853.     dc.w    138        ;top edge
  5854.     dc.w    632        ;width
  5855.     dc.w    12        ;height
  5856.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5857.     dc.w    GACT_RELVERIFY    ;activation
  5858.     dc.w    GTYP_BOOLGADGET    ;type
  5859.     dc.l    pgad1a        ;select render
  5860.     dc.l    0        ;gadget render
  5861.     dc.l    0        ;gadget text
  5862.     dc.l    0        ;mutual exclude
  5863.     dc.l    0        ;special info
  5864.     dc.w    0        ;gadget id
  5865.     dc.l    0        ;use data ptr
  5866.  
  5867. prefsgad11    dc.l    prefsgad12        ;next gadget
  5868.     dc.w    4        ;left edge
  5869.     dc.w    150        ;top edge
  5870.     dc.w    632        ;width
  5871.     dc.w    12        ;height
  5872.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5873.     dc.w    GACT_RELVERIFY    ;activation
  5874.     dc.w    GTYP_BOOLGADGET    ;type
  5875.     dc.l    pgad1a        ;select render
  5876.     dc.l    0        ;gadget render
  5877.     dc.l    pgadtxt10        ;gadget text
  5878.     dc.l    0        ;mutual exclude
  5879.     dc.l    0        ;special info
  5880.     dc.w    0        ;gadget id
  5881.     dc.l    0        ;use data ptr
  5882.  
  5883. prefsgad12    dc.l    prefsgad13        ;next gadget
  5884.     dc.w    4        ;left edge
  5885.     dc.w    162        ;top edge
  5886.     dc.w    632        ;width
  5887.     dc.w    12        ;height
  5888.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5889.     dc.w    GACT_RELVERIFY    ;activation
  5890.     dc.w    GTYP_BOOLGADGET    ;type
  5891.     dc.l    pgad1a        ;select render
  5892.     dc.l    0        ;gadget render
  5893.     dc.l    0        ;gadget text
  5894.     dc.l    0        ;mutual exclude
  5895.     dc.l    0        ;special info
  5896.     dc.w    0        ;gadget id
  5897.     dc.l    0        ;use data ptr
  5898.     
  5899. prefsgad13    dc.l    prefsgad14        ;next gadget
  5900.     dc.w    4        ;left edge
  5901.     dc.w    174        ;top edge
  5902.     dc.w    632        ;width
  5903.     dc.w    12        ;height
  5904.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5905.     dc.w    GACT_RELVERIFY    ;activation
  5906.     dc.w    GTYP_BOOLGADGET    ;type
  5907.     dc.l    pgad1a        ;select render
  5908.     dc.l    0        ;gadget render
  5909.     dc.l    pgadtxt11        ;gadget text
  5910.     dc.l    0        ;mutual exclude
  5911.     dc.l    0        ;special info
  5912.     dc.w    0        ;gadget id
  5913.     dc.l    0        ;use data ptr
  5914.  
  5915. prefsgad14    dc.l    0        ;next gadget
  5916.     dc.w    4        ;left edge
  5917.     dc.w    186        ;top edge
  5918.     dc.w    632        ;width
  5919.     dc.w    12        ;height
  5920.     dc.w    GFLG_GADGIMAGE|GFLG_GADGHIMAGE;flags
  5921.     dc.w    GACT_RELVERIFY    ;activation
  5922.     dc.w    GTYP_BOOLGADGET    ;type
  5923.     dc.l    pgad1a        ;select render
  5924.     dc.l    0        ;gadget render
  5925.     dc.l    pgadtxt12        ;gadget text
  5926.     dc.l    0        ;mutual exclude
  5927.     dc.l    0        ;special info
  5928.     dc.w    0        ;gadget id
  5929.     dc.l    0        ;use data ptr
  5930.  
  5931. pgad1a    dc.w    0        ;left edge
  5932.     dc.w    0        ;top edge
  5933.     dc.w    632        ;width
  5934.     dc.w    12        ;height
  5935.     dc.w    1        ;depth
  5936.     dc.l    gadgetimage        ;image data
  5937.     dc.b    2        ;planepick
  5938.     dc.b    0        ;plane on/off
  5939.     dc.l    0        ;next image
  5940.  
  5941. pgadtxt1    dc.b    1        ;front pen
  5942.     dc.b    0        ;back pen
  5943.     dc.b    RP_JAM2        ;draw mode
  5944.     dc.b    0        ;pad byte
  5945.     dc.w    29        ;left edge
  5946.     dc.w    2        ;top edge
  5947.     dc.l    0        ;font
  5948.     dc.l    ptxt1        ;text
  5949.     dc.l    0        ;next intuitext
  5950.  
  5951. pgadtxt2    dc.b    1        ;front pen
  5952.     dc.b    0        ;back pen
  5953.     dc.b    RP_JAM2        ;draw mode
  5954.     dc.b    0        ;pad byte
  5955.     dc.w    29        ;left edge
  5956.     dc.w    2        ;top edge
  5957.     dc.l    0        ;font
  5958.     dc.l    ptxt2        ;text
  5959.     dc.l    0        ;next intuitext
  5960.  
  5961. pgadtxt3    dc.b    1        ;front pen
  5962.     dc.b    0        ;back pen
  5963.     dc.b    RP_JAM2        ;draw mode
  5964.     dc.b    0        ;pad byte
  5965.     dc.w    29        ;left edge
  5966.     dc.w    2        ;top edge
  5967.     dc.l    0        ;font
  5968.     dc.l    ptxt3        ;text
  5969.     dc.l    0        ;next intuitext
  5970.  
  5971. pgadtxt4    dc.b    1        ;front pen
  5972.     dc.b    0        ;back pen
  5973.     dc.b    RP_JAM2        ;draw mode
  5974.     dc.b    0        ;pad byte
  5975.     dc.w    29        ;left edge
  5976.     dc.w    2        ;top edge
  5977.     dc.l    0        ;font
  5978.     dc.l    ptxt4        ;text
  5979.     dc.l    0        ;next intuitext
  5980.  
  5981. pgadtxt5    dc.b    1        ;front pen
  5982.     dc.b    0        ;back pen
  5983.     dc.b    RP_JAM2        ;draw mode
  5984.     dc.b    0        ;pad byte
  5985.     dc.w    29        ;left edge
  5986.     dc.w    2        ;top edge
  5987.     dc.l    0        ;font
  5988.     dc.l    ptxt5        ;text
  5989.     dc.l    0        ;next intuitext
  5990.  
  5991. pgadtxt6    dc.b    1        ;front pen
  5992.     dc.b    0        ;back pen
  5993.     dc.b    RP_JAM2        ;draw mode
  5994.     dc.b    0        ;pad byte
  5995.     dc.w    29        ;left edge
  5996.     dc.w    2        ;top edge
  5997.     dc.l    0        ;font
  5998.     dc.l    ptxt6        ;text
  5999.     dc.l    0        ;next intuitext
  6000.  
  6001. pgadtxt7    dc.b    1        ;front pen
  6002.     dc.b    0        ;back pen
  6003.     dc.b    RP_JAM2        ;draw mode
  6004.     dc.b    0        ;pad byte
  6005.     dc.w    29        ;left edge
  6006.     dc.w    2        ;top edge
  6007.     dc.l    0        ;font
  6008.     dc.l    ptxt7        ;text
  6009.     dc.l    0        ;next intuitext
  6010.  
  6011. pgadtxt8    dc.b    1        ;front pen
  6012.     dc.b    0        ;back pen
  6013.     dc.b    RP_JAM2        ;draw mode
  6014.     dc.b    0        ;pad byte
  6015.     dc.w    29        ;left edge
  6016.     dc.w    2        ;top edge
  6017.     dc.l    0        ;font
  6018.     dc.l    ptxt8        ;text
  6019.     dc.l    0        ;next intuitext
  6020.  
  6021. pgadtxt9    dc.b    1        ;front pen
  6022.     dc.b    0        ;back pen
  6023.     dc.b    RP_JAM2        ;draw mode
  6024.     dc.b    0        ;pad byte
  6025.     dc.w    29        ;left edge
  6026.     dc.w    2        ;top edge
  6027.     dc.l    0        ;font
  6028.     dc.l    ptxt9        ;text
  6029.     dc.l    0        ;next intuitext
  6030.  
  6031. pgadtxt10    dc.b    1        ;front pen
  6032.     dc.b    0        ;back pen
  6033.     dc.b    RP_JAM2        ;draw mode
  6034.     dc.b    0        ;pad byte
  6035.     dc.w    29        ;left edge
  6036.     dc.w    2        ;top edge
  6037.     dc.l    0        ;font
  6038.     dc.l    ptxt10        ;text
  6039.     dc.l    0        ;next intuitext
  6040.  
  6041. pgadtxt11    dc.b    1        ;front pen
  6042.     dc.b    0        ;back pen
  6043.     dc.b    RP_JAM2        ;draw mode
  6044.     dc.b    0        ;pad byte
  6045.     dc.w    29        ;left edge
  6046.     dc.w    2        ;top edge
  6047.     dc.l    0        ;font
  6048.     dc.l    ptxt11        ;text
  6049.     dc.l    0        ;next intuitext
  6050.  
  6051. pgadtxt12    dc.b    1        ;front pen
  6052.     dc.b    0        ;back pen
  6053.     dc.b    RP_JAM2        ;draw mode
  6054.     dc.b    0        ;pad byte
  6055.     dc.w    29        ;left edge
  6056.     dc.w    2        ;top edge
  6057.     dc.l    0        ;font
  6058.     dc.l    ptxt12        ;text
  6059.     dc.l    0        ;next intuitext
  6060.  
  6061. ;picsavegad1    dc.w    150,50        ;left,top
  6062. ;    dc.w    150,50        ;width,height
  6063. ;    dc.l    psgad1title        ;gadget text
  6064. ;    dc.l    textattr        ;text attr
  6065. ;    dc.w    1        ;gadget id
  6066. ;    dc.l    0        ;flags
  6067. ;visinfo2    dc.l    0        ;visual info
  6068. ;    dc.l    0        ;user data
  6069. ;psgad1title    dc.b    'Image Save Format',0
  6070. ;
  6071. ;textattr    dc.l    topazname
  6072. ;    dc.w    8
  6073. ;    dc.b    FS_NORMAL
  6074. ;    dc.b    FPF_ROMFONT
  6075. ;topazname    dc.b    "Topaz",0
  6076. ;
  6077. statbartxt
  6078. statbfg    dc.b    1        ;front pen
  6079. statbbg    dc.b    0        ;back pen
  6080.     dc.b    RP_JAM2        ;draw mode
  6081.     dc.b    0        ;pad byte
  6082.     dc.w    0        ;left edge
  6083.     dc.w    0        ;top edge
  6084.     dc.l    0        ;font
  6085.     dc.l    stattxt        ;text
  6086.     dc.l    0        ;next intuitext
  6087.  
  6088. intuiloadtxt
  6089. blkpen1    dc.b    1        ;front pen
  6090. detpen1    dc.b    0        ;back pen
  6091.     dc.b    RP_JAM2        ;draw mode
  6092.     dc.b    0        ;pad byte
  6093.     dc.w    0        ;left edge
  6094.     dc.w    0        ;top edge
  6095.     dc.l    0        ;font
  6096.     dc.l    loadtxt2        ;text
  6097.     dc.l    0        ;next intuitext
  6098.  
  6099. menu1    dc.l    menu2        ;next menu
  6100.     dc.w    5        ;left edge
  6101.     dc.w    0        ;top edge
  6102.     dc.w    63        ;width
  6103.     dc.w    10        ;height
  6104.     dc.w    MENUENABLED        ;flags
  6105.     dc.l    menu1txt        ;menu name
  6106.     dc.l    m1option1        ;first item
  6107.     dc.w    0        ;jazz x
  6108.     dc.w    0        ;jaxx y
  6109.     dc.w    0        ;beat x
  6110.     dc.w    0        ;beat y
  6111.     
  6112. menu1txt    dc.b    'Project',0
  6113.  
  6114. m1option1    dc.l    m1option2        ;next item
  6115.     dc.w    0        ;left edge
  6116.     dc.w    0        ;top edge
  6117.     dc.w    150        ;width
  6118.     dc.w    10        ;height
  6119.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6120.     dc.l    0        ;mutual exclude
  6121.     dc.l    m1opt1itext        ;item fill
  6122.     dc.l    0        ;select fill
  6123.     dc.b    'L'        ;command
  6124.     dc.b    0        ;pad byte
  6125.     dc.l    0        ;sub item
  6126.     dc.w    0        ;next select
  6127.     
  6128. m1opt1itext    dc.b    1        ;front pen
  6129.     dc.b    2        ;back pen
  6130.     dc.b    RP_JAM2        ;draw mode
  6131.     dc.b    0        ;pad byte
  6132.     dc.w    0        ;left edge
  6133.     dc.w    1        ;top edge
  6134.     dc.l    0        ;font
  6135.     dc.l    m1opt1txt        ;text
  6136.     dc.l    0        ;next intuitext
  6137.  
  6138. m1opt1txt    dc.b    'Load Image',0
  6139.  
  6140. m1option2    dc.l    m1option3        ;next item
  6141.     dc.w    0        ;top edge
  6142.     dc.w    10        ;left edge
  6143.     dc.w    150        ;width
  6144.     dc.w    10        ;height
  6145.     dc.w    HIGHCOMP|ITEMENABLED|ITEMTEXT;flags
  6146.     dc.l    0        ;mutual exclude
  6147.     dc.l    m1opt2itext        ;item fill
  6148.     dc.l    0        ;select fill
  6149.     dc.b    0        ;command
  6150.     dc.b    0        ;pad byte
  6151.     dc.l    m1option2s1        ;sub item
  6152.     dc.w    0        ;next select
  6153.  
  6154. m1opt2itext    dc.b    1        ;front pen
  6155.     dc.b    2        ;back pen
  6156.     dc.b    RP_JAM2        ;draw mode
  6157.     dc.b    0        ;pad byte
  6158.     dc.w    0        ;left edge
  6159.     dc.w    1        ;top edge
  6160.     dc.l    0        ;font
  6161.     dc.l    m1opt2txt        ;text
  6162.     dc.l    0        ;next intuitext
  6163.     
  6164. m1opt2txt    dc.b    'Save Image',0
  6165.  
  6166. m1option2s1    dc.l    m1option2s2        ;next item
  6167.     dc.w    100        ;left edge
  6168.     dc.w    -5        ;top edge
  6169.     dc.w    150        ;width
  6170.     dc.w    10        ;height
  6171.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6172.     dc.l    0        ;mutual exclude
  6173.     dc.l    m1o2s1itext        ;item fill
  6174.     dc.l    0        ;select fill
  6175.     dc.b    'R'        ;command
  6176.     dc.b    0        ;pad byte
  6177.     dc.l    0        ;sub item
  6178.     dc.w    0        ;next select
  6179.  
  6180. m1o2s1itext    dc.b    1        ;front pen
  6181.     dc.b    2        ;back pen
  6182.     dc.b    RP_JAM2        ;draw mode
  6183.     dc.b    0        ;pad byte
  6184.     dc.w    0        ;left edge
  6185.     dc.w    1        ;top edge
  6186.     dc.l    0        ;font
  6187.     dc.l    m1o2s1txt        ;text
  6188.     dc.l    0        ;next intuitext
  6189.  
  6190. m1o2s1txt    dc.b    'as raw data',0
  6191.  
  6192. m1option2s2    dc.l    0        ;next item
  6193.     dc.w    100        ;left edge
  6194.     dc.w    5        ;top edge
  6195.     dc.w    150        ;width
  6196.     dc.w    10        ;height
  6197.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6198.     dc.l    0        ;mutual exclude
  6199.     dc.l    m1o2s2itext        ;item fill
  6200.     dc.l    0        ;select fill
  6201.     dc.b    'I'        ;command
  6202.     dc.b    0        ;pad byte
  6203.     dc.l    0        ;sub item
  6204.     dc.w    0        ;next select
  6205.  
  6206. m1o2s2itext    dc.b    1        ;front pen
  6207.     dc.b    2        ;back pen
  6208.     dc.b    RP_JAM2        ;draw mode
  6209.     dc.b    0        ;pad byte
  6210.     dc.w    0        ;left edge
  6211.     dc.w    1        ;top edge
  6212.     dc.l    0        ;font
  6213.     dc.l    m1o2s2txt        ;text
  6214.     dc.l    0        ;next intuitext
  6215.     
  6216. m1o2s2txt    dc.b    'as IFF/ILBM',0
  6217.  
  6218. m1option3    dc.l    m1option4        ;next item
  6219.     dc.w    0        ;left edge
  6220.     dc.w    20        ;top edge
  6221.     dc.w    150        ;width
  6222.     dc.w    10        ;height
  6223.     dc.w    HIGHCOMP|ITEMENABLED|ITEMTEXT;flags
  6224.     dc.l    0        ;mutual exclude
  6225.     dc.l    m1opt3itext        ;item fill
  6226.     dc.l    0        ;select fill
  6227.     dc.b    0        ;command
  6228.     dc.b    0        ;pad byte
  6229.     dc.l    m1opt3sub1        ;sub item
  6230.     dc.w    0        ;next select
  6231.  
  6232. m1opt3itext    dc.b    1        ;front pen
  6233.     dc.b    2        ;back pen
  6234.     dc.b    RP_JAM2        ;draw mode
  6235.     dc.b    0        ;pad byte
  6236.     dc.w    0        ;left edge
  6237.     dc.w    1        ;top edge
  6238.     dc.l    0        ;font
  6239.     dc.l    m1opt3txt        ;text
  6240.     dc.l    0        ;next intuitext
  6241.  
  6242. m1opt3txt    dc.b    'Save Brush',0
  6243.  
  6244. m1opt3sub1    dc.l    m1opt3sub2        ;next item
  6245.     dc.w    100        ;left edge
  6246.     dc.w    -5        ;top edge
  6247.     dc.w    150        ;width
  6248.     dc.w    10        ;height
  6249.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6250.     dc.l    0        ;mutual exclude
  6251.     dc.l    m1o3s1itext        ;item fill
  6252.     dc.l    0        ;select fill
  6253.     dc.b    'A'        ;command
  6254.     dc.b    0        ;pad byte
  6255.     dc.l    0        ;sub item
  6256.     dc.w    0        ;next select
  6257.  
  6258. m1o3s1itext    dc.b    1        ;front pen
  6259.     dc.b    2        ;back pen
  6260.     dc.b    RP_JAM2        ;draw mode
  6261.     dc.b    0        ;pad byte
  6262.     dc.w    0        ;left edge
  6263.     dc.w    1        ;top edge
  6264.     dc.l    0        ;font
  6265.     dc.l    m1o3s1txt        ;text
  6266.     dc.l    0        ;next intuitext
  6267.  
  6268. m1o3s1txt    dc.b    'as raw data',0
  6269.     
  6270. m1opt3sub2    dc.l    0        ;next item
  6271.     dc.w    100        ;left edge
  6272.     dc.w    5        ;top edge
  6273.     dc.w    150        ;width
  6274.     dc.w    10        ;height
  6275.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6276.     dc.l    0        ;mutual exclude
  6277.     dc.l    m1o3s2itext        ;item fill
  6278.     dc.l    0        ;select fill
  6279.     dc.b    'F'        ;command
  6280.     dc.b    0        ;pad byte
  6281.     dc.l    0        ;sub item
  6282.     dc.w    0        ;next select
  6283.  
  6284. m1o3s2itext    dc.b    1        ;front pen
  6285.     dc.b    2        ;back pen
  6286.     dc.b    RP_JAM2        ;draw mode
  6287.     dc.b    0        ;pad byte
  6288.     dc.w    0        ;left edge
  6289.     dc.w    1        ;top edge
  6290.     dc.l    0        ;font
  6291.     dc.l    m1o3s2txt        ;text
  6292.     dc.l    0        ;next intuitext
  6293.  
  6294. m1o3s2txt    dc.b    'as IFF/ILBM',0
  6295.  
  6296. m1option4    dc.l    m1option5        ;next item
  6297.     dc.w    0        ;left edge
  6298.     dc.w    30        ;top edge
  6299.     dc.w    150        ;width
  6300.     dc.w    10        ;height
  6301.     dc.w    HIGHCOMP|ITEMENABLED|ITEMTEXT;flags
  6302.     dc.l    0        ;mutual exclude
  6303.     dc.l    m1opt4itext        ;item fill
  6304.     dc.l    0        ;select fill
  6305.     dc.b    0        ;command
  6306.     dc.b    0        ;pad byte
  6307.     dc.l    m1opt4sub1        ;sub item
  6308.     dc.w    0        ;next select
  6309.  
  6310. m1opt4itext    dc.b    1        ;front pen
  6311.     dc.b    2        ;back pen
  6312.     dc.b    RP_JAM2        ;draw mode
  6313.     dc.b    0        ;pad byte
  6314.     dc.w    0        ;top edge
  6315.     dc.w    1        ;left edge
  6316.     dc.l    0        ;font
  6317.     dc.l    m1opt4txt        ;text
  6318.     dc.l    0        ;next intuitext
  6319.     
  6320. m1opt4txt    dc.b    'Save Sprite',0
  6321.  
  6322. m1opt4sub1    dc.l    m1opt4sub2        ;next item
  6323.     dc.w    100        ;left edge
  6324.     dc.w    -10        ;top edge
  6325.     dc.w    120        ;width
  6326.     dc.w    10        ;height
  6327.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6328.     dc.l    0        ;mutual exclude
  6329.     dc.l    m1o4s1itext        ;item fill
  6330.     dc.l    0        ;select fill
  6331.     dc.b    '1'        ;command
  6332.     dc.b    0        ;pad byte
  6333.     dc.l    0        ;sub item
  6334.     dc.w    0        ;next select
  6335.  
  6336. m1o4s1itext    dc.b    1        ;front pen
  6337.     dc.b    2        ;back pen
  6338.     dc.b    RP_JAM2        ;draw mode
  6339.     dc.b    0        ;pad byte
  6340.     dc.w    0        ;left edge
  6341.     dc.w    1        ;top edge
  6342.     dc.l    0        ;font
  6343.     dc.l    m1o4s1txt        ;text
  6344.     dc.l    0        ;next intuitext
  6345.  
  6346. m1o4s1txt    dc.b    '16 pa1el',0
  6347.  
  6348. m1opt4sub2    dc.l    m1opt4sub3        ;next item
  6349.     dc.w    100        ;left edge
  6350.     dc.w    0        ;top edge
  6351.     dc.w    120        ;width
  6352.     dc.w    10        ;height
  6353.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6354.     dc.l    0        ;mutual exclude
  6355.     dc.l    m1o4s2itext        ;item fill
  6356.     dc.l    0        ;select fill
  6357.     dc.b    '3'        ;command
  6358.     dc.b    0        ;pad byte
  6359.     dc.l    0        ;sub item
  6360.     dc.w    0        ;next select
  6361.     
  6362. m1o4s2itext    dc.b    1        ;front pen
  6363.     dc.b    2        ;back pen
  6364.     dc.b    1        ;draw mode
  6365.     dc.b    0        ;pad byte
  6366.     dc.w    0        ;left edge
  6367.     dc.w    1        ;top edge
  6368.     dc.l    0        ;font
  6369.     dc.l    m1o4s2txt        ;text
  6370.     dc.l    0        ;next intuitext
  6371.  
  6372. m1o4s2txt    dc.b    '32 pa1el',0
  6373.  
  6374. m1opt4sub3    dc.l    0        ;next item
  6375.     dc.w    100        ;left edge
  6376.     dc.w    10        ;top edge
  6377.     dc.w    120        ;width
  6378.     dc.w    10        ;height
  6379.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6380.     dc.l    0        ;mutual exclude
  6381.     dc.l    m1o4s3itext        ;item fill
  6382.     dc.l    0        ;select fill
  6383.     dc.b    '6'        ;command
  6384.     dc.b    0        ;pad byte
  6385.     dc.l    0        ;sub item
  6386.     dc.w    0        ;next select
  6387.  
  6388. m1o4s3itext    dc.b    1        ;front pen
  6389.     dc.b    2        ;back pen
  6390.     dc.b    RP_JAM2        ;draw mode
  6391.     dc.b    0        ;pad byte
  6392.     dc.w    0        ;left edge
  6393.     dc.w    1        ;top edge
  6394.     dc.l    0        ;font
  6395.     dc.l    m1o4s3txt        ;text
  6396.     dc.l    0        ;next intuitext
  6397.  
  6398. m1o4s3txt    dc.b    '64 pa1el',0
  6399.  
  6400. m1option5    dc.l    m1option6        ;next item
  6401.     dc.w    0        ;left edge
  6402.     dc.w    40        ;top edge
  6403.     dc.w    150        ;width
  6404.     dc.w    10        ;height
  6405.     dc.w    0        ;flags
  6406.     dc.l    0        ;mutual exclude
  6407.     dc.l    m1o5image        ;item fill
  6408.     dc.l    0        ;select fill
  6409.     dc.b    0        ;command
  6410.     dc.b    0        ;pad byte
  6411.     dc.l    0        ;sub item
  6412.     dc.w    0        ;next select
  6413.  
  6414. m1o5image    dc.w    0        ;left edge
  6415.     dc.w    4        ;top edge
  6416.     dc.w    150        ;width
  6417.     dc.w    2        ;height
  6418.     dc.w    0        ;depth
  6419.     dc.l    0        ;image data
  6420.     dc.b    0        ;plane pick
  6421.     dc.b    0        ;plane on off
  6422.     dc.l    0        ;next image
  6423.  
  6424. m1option6    dc.l    m1option7        ;next item
  6425.     dc.w    0        ;left edge
  6426.     dc.w    50        ;top edge
  6427.     dc.w    150        ;width
  6428.     dc.w    10        ;height
  6429.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6430.     dc.l    0        ;mutual exclude
  6431.     dc.l    m1opt6itext        ;item fill
  6432.     dc.l    0        ;select fill
  6433.     dc.b    'S'        ;command
  6434.     dc.b    0        ;pad byte
  6435.     dc.l    0        ;sub item
  6436.     dc.w    0        ;next select
  6437.  
  6438. m1opt6itext    dc.b    1        ;front pen
  6439.     dc.b    2        ;back pen
  6440.     dc.b    RP_JAM2        ;draw mode
  6441.     dc.b    0        ;pad byte
  6442.     dc.w    0        ;left edge
  6443.     dc.w    1        ;top edge
  6444.     dc.l    0        ;font
  6445.     dc.l    m1opt6txt        ;text
  6446.     dc.l    0        ;next intuitext
  6447.  
  6448. m1opt6txt    dc.b    'Screen Mode',0
  6449.  
  6450.  
  6451. m1option7    dc.l    m1option8        ;next item
  6452.     dc.w    0        ;left edge
  6453.     dc.w    60        ;top edge
  6454.     dc.w    150        ;width
  6455.     dc.w    10        ;height
  6456.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6457.     dc.l    0        ;mutual exclude
  6458.     dc.l    m1opt7itext        ;item fill
  6459.     dc.l    0        ;select fill
  6460.     dc.b    'P'        ;command
  6461.     dc.b    0        ;pad byte
  6462.     dc.l    0        ;sub item
  6463.     dc.w    0        ;next select
  6464.  
  6465. m1opt7itext    dc.b    1        ;front pen
  6466.     dc.b    2        ;back pen
  6467.     dc.b    RP_JAM2        ;draw mode
  6468.     dc.b    0        ;pad byte
  6469.     dc.w    0        ;left edge
  6470.     dc.w    1        ;top edge
  6471.     dc.l    0        ;font
  6472.     dc.l    m1opt7txt        ;text
  6473.     dc.l    0        ;next intuitext
  6474.  
  6475. m1opt7txt    dc.b    'Preferences',0
  6476.  
  6477. m1option8    dc.l    m1option9        ;next item
  6478.     dc.w    0        ;left edge
  6479.     dc.w    70        ;top edge
  6480.     dc.w    150        ;width
  6481.     dc.w    10        ;height
  6482.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6483.     dc.l    0        ;mutual exclude
  6484.     dc.l    m1opt8itext        ;item fill
  6485.     dc.l    0        ;select fill
  6486.     dc.b    '!'        ;command
  6487.     dc.b    0        ;pad byte
  6488.     dc.l    0        ;sub item
  6489.     dc.w    0        ;next select
  6490.  
  6491. m1opt8itext    dc.b    1        ;front pen
  6492.     dc.b    2        ;back pen
  6493.     dc.b    1        ;draw mode
  6494.     dc.b    0        ;pad byte
  6495.     dc.w    0        ;left edge
  6496.     dc.w    1        ;top edge
  6497.     dc.l    0        ;font
  6498.     dc.l    m1opt8txt        ;text
  6499.     dc.l    0        ;next intuitext
  6500.  
  6501. m1opt8txt    dc.b    'About',0
  6502.  
  6503. m1option9    dc.l    m1option10        ;next item
  6504.     dc.w    0        ;left edge
  6505.     dc.w    80        ;top edge
  6506.     dc.w    150        ;width
  6507.     dc.w    10        ;height
  6508.     dc.w    0        ;flags
  6509.     dc.l    0        ;mutual exclude
  6510.     dc.l    m1o5image        ;item fill
  6511.     dc.l    0        ;select fill
  6512.     dc.b    0        ;command
  6513.     dc.b    0        ;pad byte
  6514.     dc.l    0        ;sub item
  6515.     dc.w    0        ;next select
  6516.  
  6517. m1option10    dc.l    0        ;next item
  6518.     dc.w    0        ;left edge
  6519.     dc.w    90        ;top edge
  6520.     dc.w    150        ;width
  6521.     dc.w    10        ;height
  6522.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6523.     dc.l    0        ;mutual exclude
  6524.     dc.l    m1opt10itext    ;item fill
  6525.     dc.l    0        ;select fill
  6526.     dc.b    $51        ;command
  6527.     dc.b    0        ;pad byte
  6528.     dc.l    0        ;sub item
  6529.     dc.w    0        ;next select
  6530.  
  6531. m1opt10itext
  6532.     dc.b    1        ;front pen
  6533.     dc.b    2        ;back pen
  6534.     dc.b    1        ;draw mode
  6535.     dc.b    0        ;pad byte
  6536.     dc.w    0        ;left edge
  6537.     dc.w    1        ;top edge
  6538.     dc.l    0        ;font
  6539.     dc.l    m1opt10txt        ;text
  6540.     dc.l    0        ;next intuitext
  6541.  
  6542. m1opt10txt    dc.b    'Quit',0,0
  6543.  
  6544.  
  6545. menu2    dc.l    0        ;next menu
  6546.     dc.w    80        ;left edge
  6547.     dc.w    0        ;top edge
  6548.     dc.w    63        ;width
  6549.     dc.w    10        ;height
  6550.     dc.w    MENUENABLED        ;flags
  6551.     dc.l    menu2txt        ;menu name
  6552.     dc.l    m2option1        ;first item
  6553.     dc.w    0        ;jazz x
  6554.     dc.w    0        ;jazz y
  6555.     dc.w    0        ;beat x
  6556.     dc.w    0        ;beat y
  6557.     
  6558. menu2txt    dc.b    'Toolbox',0
  6559.  
  6560. m2option1    dc.l    m2option2        ;next item
  6561.     dc.w    0        ;left edge
  6562.     dc.w    0        ;top edge
  6563.     dc.w    178        ;width
  6564.     dc.w    10        ;height
  6565.     dc.w    HIGHCOMP|ITEMENABLED|ITEMTEXT;flags
  6566.     dc.l    0        ;mutual exclude
  6567.     dc.l    m2opt1itext        ;item fill
  6568.     dc.l    0        ;select fill
  6569.     dc.b    0        ;command
  6570.     dc.b    0        ;pad byte
  6571.     dc.l    0        ;sub item
  6572.     dc.w    0        ;next select
  6573.  
  6574. m2opt1itext    dc.b    1        ;front pen
  6575.     dc.b    2        ;back pen
  6576.     dc.b    RP_JAM2        ;draw mode
  6577.     dc.b    0        ;pad byte
  6578.     dc.w    0        ;left edge
  6579.     dc.w    1        ;top edge
  6580.     dc.l    0        ;font
  6581.     dc.l    m2opt1txt        ;text
  6582.     dc.l    0        ;next intuitext
  6583.  
  6584. m2opt1txt    dc.b    'Cut Brush            b',0
  6585.  
  6586. m2option2    dc.l    m2option3        ;next item
  6587.     dc.w    0        ;left edge
  6588.     dc.w    10        ;top edge
  6589.     dc.w    178        ;width
  6590.     dc.w    10        ;height
  6591.     dc.w    HIGHCOMP|ITEMENABLED|ITEMTEXT;flags
  6592.     dc.l    0        ;mutual exclude
  6593.     dc.l    m2opt2itext        ;item fill
  6594.     dc.l    0        ;select fill
  6595.     dc.b    0        ;command
  6596.     dc.b    0        ;pad byte
  6597.     dc.l    0        ;sub item
  6598.     dc.w    0        ;next select
  6599.  
  6600. m2opt2itext    dc.b    1        ;front pen
  6601.     dc.b    2        ;back pen
  6602.     dc.b    RP_JAM2        ;draw mode
  6603.     dc.b    0        ;pad byte
  6604.     dc.w    0        ;left edge
  6605.     dc.w    1        ;top edge
  6606.     dc.l    0        ;font
  6607.     dc.l    m2opt2txt        ;text
  6608.     dc.l    0        ;next intuitext
  6609.  
  6610. m2opt2txt    dc.b    'Set Palette          p',0
  6611.  
  6612. m2option3    dc.l    m2option4        ;next item
  6613.     dc.w    0        ;left edge
  6614.     dc.w    20        ;top edge
  6615.     dc.w    178        ;width
  6616.     dc.w    10        ;height
  6617.     dc.w    0        ;flags
  6618.     dc.l    0        ;mutual exclude
  6619.     dc.l    m2opt3image        ;item fill
  6620.     dc.l    0        ;select fill
  6621.     dc.b    0        ;command
  6622.     dc.b    0        ;pad byte
  6623.     dc.l    0        ;sub item
  6624.     dc.w    0        ;next select
  6625.  
  6626. m2opt3image    dc.w    0        ;left edge
  6627.     dc.w    4        ;top edge
  6628.     dc.w    178        ;width
  6629.     dc.w    2        ;height
  6630.     dc.w    0        ;depth
  6631.     dc.l    0        ;image data
  6632.     dc.b    0        ;plane pick
  6633.     dc.b    0        ;plane on/off
  6634.     dc.l    0        ;next image
  6635.  
  6636. m2option4    dc.l    m2option5        ;next item
  6637.     dc.w    0        ;left edge
  6638.     dc.w    30        ;top edge
  6639.     dc.w    178        ;width
  6640.     dc.w    10        ;height
  6641.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6642.     dc.l    0        ;mutual exclude
  6643.     dc.l    m2opt4itext        ;item fill
  6644.     dc.l    0        ;select fill
  6645.     dc.b    'G'        ;command
  6646.     dc.b    0        ;pad byte
  6647.     dc.l    0        ;sub item
  6648.     dc.w    0        ;next item
  6649.  
  6650. m2opt4itext    dc.b    1        ;front pen
  6651.     dc.b    2        ;back pen
  6652.     dc.b    RP_JAM2        ;draw mode
  6653.     dc.b    0        ;pad byte
  6654.     dc.w    0        ;left edge
  6655.     dc.w    1        ;top edge
  6656.     dc.l    0        ;font
  6657.     dc.l    m2opt4txt        ;text
  6658.     dc.l    0        ;next intuitext
  6659.  
  6660. m2opt4txt    dc.b    'Generate Palette',0
  6661.  
  6662. m2option5    dc.l    m2option6        ;next item
  6663.     dc.w    0        ;left edge
  6664.     dc.w    40        ;top edge
  6665.     dc.w    178        ;width
  6666.     dc.w    10        ;height
  6667.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6668.     dc.l    0        ;mutual exclude
  6669.     dc.l    m2opt5itext        ;item fill
  6670.     dc.l    0        ;select fill
  6671.     dc.b    'B'        ;command
  6672.     dc.b    0        ;pad byte
  6673.     dc.l    0        ;sub item
  6674.     dc.w    0        ;next select
  6675.  
  6676. m2opt5itext    dc.b    1        ;front pen
  6677.     dc.b    2        ;back pen
  6678.     dc.b    RP_JAM2        ;draw mode
  6679.     dc.b    0        ;pad byte
  6680.     dc.w    0        ;left edge
  6681.     dc.w    1        ;top edge
  6682.     dc.l    0        ;font
  6683.     dc.l    m2opt5txt        ;text
  6684.     dc.l    0        ;next intuitext
  6685.  
  6686. m2opt5txt    dc.b    'Save Brush Mask',0
  6687.  
  6688. m2option6    dc.l    0        ;next item
  6689.     dc.w    0        ;left edge
  6690.     dc.w    50        ;top edge
  6691.     dc.w    178        ;width
  6692.     dc.w    10        ;height
  6693.     dc.w    HIGHCOMP|ITEMENABLED|COMMSEQ|ITEMTEXT;flags
  6694.     dc.l    0        ;mutual exclude
  6695.     dc.l    m2opt6itext        ;item fill
  6696.     dc.l    0        ;select fill
  6697.     dc.b    'M'        ;command
  6698.     dc.b    0        ;pad byte
  6699.     dc.l    0        ;sub item
  6700.     dc.w    0        ;next select
  6701.  
  6702. m2opt6itext    dc.b    1        ;front pen
  6703.     dc.b    2        ;back pen
  6704.     dc.b    RP_JAM2        ;draw mode
  6705.     dc.b    0        ;pad byte
  6706.     dc.w    0        ;left edge
  6707.     dc.w    1        ;top edge
  6708.     dc.l    0        ;font
  6709.     dc.l    m2opt6txt        ;text
  6710.     dc.l    0        ;next intuitext
  6711.  
  6712. m2opt6txt    dc.b    'Save Picture Mask',0
  6713.  
  6714. loadtags    dc.l    RTFI_Dir
  6715.     dc.l    loaddir
  6716.     dc.l    TAG_DONE
  6717.     
  6718. savetags    dc.l    RTFI_Dir
  6719.     dc.l    savedir
  6720.     dc.l    TAG_DONE
  6721.     
  6722. tags2    dc.l    RT_ReqPos
  6723.     dc.l    1
  6724.     dc.l    TAG_DONE
  6725.     
  6726. taglist    dc.l    RT_ReqPos
  6727.     dc.l    1
  6728.     dc.l    RTEZ_Flags
  6729.     dc.l    7
  6730.     dc.l    RT_Window
  6731. winpt2    dc.l    0
  6732.     dc.l    TAG_DONE
  6733.  
  6734. taglist2    dc.l    RT_Window
  6735. winpt3    dc.l    0
  6736.     dc.l    RT_ReqPos
  6737.     dc.l    1
  6738.     dc.l    TAG_DONE
  6739.  
  6740. sc_tags2    dc.l    RTSC_Flags
  6741.     dc.l    SCREQF_NONSTDMODES
  6742.     dc.l    RT_Window
  6743. winpt4    dc.l    0
  6744.     dc.l    RTSC_FilterFunc
  6745.     dc.l    hook
  6746.     dc.l    TAG_DONE
  6747.  
  6748. hook    dc.l    filterfunc
  6749.     dc.l    filterfunc
  6750.     dc.l    filterfunc
  6751.  
  6752. sc_tags3    dc.l    RTSC_ModeFromScreen
  6753. scrpt4    dc.l    0
  6754.     dc.l    RTSC_OverscanType
  6755.     dc.l    0
  6756.     dc.l    TAG_DONE
  6757.  
  6758. dttags    dc.l    PDTA_Remap
  6759.     dc.l    0
  6760.     dc.l    DTA_GroupID
  6761.     dc.l    GID_PICTURE
  6762.     dc.l    TAG_DONE
  6763.  
  6764. dtattrs    dc.l    DTA_NominalHoriz
  6765.     dc.l    dtwidth
  6766.     dc.l    DTA_NominalVert
  6767.     dc.l    dtheight
  6768.     dc.l    PDTA_ModeID
  6769.     dc.l    iffcamg
  6770.     dc.l    PDTA_BitMapHeader
  6771.     dc.l    bmhdaddr
  6772.     dc.l    PDTA_BitMap
  6773.     dc.l    bitmapaddr
  6774.     dc.l    PDTA_CRegs
  6775.     dc.l    colortable
  6776.     dc.l    TAG_DONE
  6777.  
  6778. dtattrs2    dc.l    GA_Left
  6779.     dc.l    0
  6780.     dc.l    GA_Top
  6781.     dc.l    0
  6782.     dc.l    GA_Width
  6783. dtwidmod    dc.l    0
  6784.     dc.l    GA_Height
  6785. dthtmod    dc.l    0
  6786.     dc.l    TAG_DONE
  6787.  
  6788. ;gadtags1    dc.l    GTMX_Labels
  6789. ;    dc.l    labels
  6790. ;    dc.l    GTMX_TitlePlace
  6791. ;    dc.l    PLACETEXT_ABOVE
  6792. ;    dc.l    TAG_DONE
  6793. ;
  6794. ;labels    dc.l    iffsavetxt
  6795. ;    dc.l    rawsavetxt
  6796. ;    dc.l    irawsavetxt
  6797. ;    dc.l    0
  6798. ;
  6799. ;iffsavetxt    dc.b    'IFF ILBM',0
  6800. ;rawsavetxt    dc.b    'Raw',0
  6801. ;irawsavetxt    dc.b    'Interleaved Raw',0
  6802. ;
  6803. palreqtxt    dc.b    'Change Colours',0
  6804.  
  6805. bodyfmt1    dc.b    'IFFMaster Pro (v0.99n)',$A
  6806.     dc.b    'by Rebel',$A
  6807.     dc.b    'This IFF Converter is very closely',$A
  6808.     dc.b    'based on ARCANEs IFFMaster (v1.0)',$A
  6809.     dc.b    'but with the inclusion of AGA',$A
  6810.     dc.b    'compatibility and some other small',$A
  6811.     dc.b    'enhancements.',$A,$A
  6812.     dc.b    'Personal greets to Lampwick, Neil',$A
  6813.     dc.b    'Richard, Richard, Fossil & Tweeky.',$A,$A
  6814.     dc.b    'This utility was written in 100%%',$A
  6815.     dc.b    'pure assembler using Devpac 3.',$A,$A
  6816.     dc.b    'Many thanks also to Lampwick for',$A
  6817.     dc.b    'lots of testing and suggestions',$A
  6818.     dc.b    'during the development of this',$A
  6819.     dc.b    'project.',$A,$A,0
  6820. gadfmt1    dc.b    'Continue',0
  6821.  
  6822.  
  6823. bodyfmt2    dc.b    'File Read Error, Load Aborted.',$A,0
  6824. gadfmt2    dc.b    'Abort',0
  6825.  
  6826. bodyfmt3    dc.b    'This file is not an ILBM file and',$A
  6827.     dc.b    'is not recognised by the',$A
  6828.     dc.b    'datatypes.library (if available)',$A,0
  6829. gadfmt3    dc.b    'Abort',0
  6830.  
  6831. bodyfmt4    dc.b    'There Is Not Enough Free Memory',$A
  6832.     dc.b    'To Load The Picture',$A,0
  6833. gadfmt4    dc.b    'Abort',0
  6834.  
  6835. bodyfmt5    dc.b    'IFF File is corrupt and has not',$A
  6836.     dc.b    'been completely loaded.',$A,0
  6837. gadfmt5    dc.b    'Continue',0
  6838.  
  6839. bodyfmt6    dc.b    'File Write Error, Save Aborted.',$A,0
  6840. gadfmt6    dc.b    'Abort',0
  6841.  
  6842. bodyfmt7    dc.b    'Unable to open preferences window.',$A,0
  6843. gadfmt7    dc.b    'Abort',0
  6844.  
  6845. bodyfmt8    dc.b    'Error while saving preferences file.',$A,0
  6846. gadfmt8    dc.b    'Continue',0
  6847.  
  6848. dosname    dc.b    'dos.library',0
  6849.  
  6850. intuiname    dc.b    'intuition.library',0
  6851. reqtname    dc.b    'reqtools.library',0
  6852. gfxname    dc.b    'graphics.library',0
  6853. gadname    dc.b    'gadtools.library',0
  6854. dtname    dc.b    'datatypes.library',0
  6855.  
  6856. dosbase    ds.l    1
  6857. intuibase    ds.l    1
  6858. reqtbase    ds.l    1
  6859. gfx39base    ds.l    1
  6860. gfxbase    ds.l    1
  6861. gadbase    ds.l    1
  6862. dtbase    ds.l    1
  6863.  
  6864. filename    ds.b    108
  6865.  
  6866. loadtxt    dc.b    'Choose Picture To Load',0
  6867. savetxt    dc.b    'Choose Filename For Save',0
  6868. savpaltxt    dc.b    'Choose Saved Palette Name',0
  6869. savmasktxt    dc.b    'Choose Mask File Name',0
  6870. savcoptxt    dc.b    'Choose Copper List File Name',0,0
  6871. wintit    dc.b    "choose screen mode",0
  6872. lwintitle    dc.b    '        Loading ILBM Image',0
  6873. swintitle    dc.b    '         Saving ILBM Image',0
  6874. srawtitle    dc.b    '          Saving RAW Image',0
  6875. mwintitle    dc.b    '         Saving Mask Image',0
  6876. scrtitle    dc.b    'IFF Master Pro v0.99 by Rebel',0,0
  6877. prefstitle    dc.b    'IFFMaster Pro Preferences',0
  6878. loadtxt2    dc.b    '0%                          100%',0
  6879. ptxt1    dc.b    'Bitplane Save Method         :  '
  6880. ptxt1a    dc.b    'Normal     ',0
  6881. ptxt2    dc.b    'Palette Info                 :  '
  6882. ptxt2a    dc.b    'None  ',0
  6883. ptxt3    dc.b    'Palette Type                 :  '
  6884. ptxt3a    dc.b    '12 Bit',0
  6885. ptxt4    dc.b    'Palette Save Method          :  '
  6886. ptxt4a    dc.b    'Source       ',0
  6887. ptxt5    dc.b    'Sprites Save Method          :  '
  6888. ptxt5a    dc.b    'Source',0
  6889. ptxt6    dc.b    'Sprite Control Words         :  '
  6890. ptxt6a    dc.b    'Off',0
  6891. ptxt7    dc.b    'Sprite Depth                 :  '
  6892. ptxt7a    dc.b    '4 Colours ',0
  6893. ptxt8    dc.b    'Extra Blitter Words          :  '
  6894. ptxt8a    dc.b    'None ',0
  6895. ptxt9    dc.b    'ILBM Compression             :  '
  6896. ptxt9a    dc.b    'Byte Run 1',0
  6897. ptxt10    dc.b    'Cancel Preferences',0
  6898. ptxt11    dc.b    'Use these Prefs',0
  6899. ptxt12    dc.b    'Save and use these prefs',0
  6900. prefsname    dc.b    'S:IFFMasterPro.prefs',0
  6901. stattxt    dc.b    'D'
  6902. depthASCII    dc.b    '  BW'
  6903. brwidASCII    dc.b    '     BH'
  6904. brhtASCII    dc.b    '     W'
  6905. widASCII    dc.b    '0000 H'
  6906. heightASCII    dc.b    '0000 '
  6907.  
  6908. statmod    dc.b    '           ',0
  6909.  
  6910. coordtxt    dc.b    'X'
  6911. xASCII    dc.b    '0000 Y'
  6912. yASCII    dc.b    '0000',0
  6913.  
  6914. addrtxt    dc.b    'A'
  6915. addrmod    dc.b    '000000     ',0
  6916.  
  6917. savemethtxt    dc.l    savemthtxt1
  6918.     dc.l    savemthtxt2
  6919.     
  6920. palinfotxt    dc.l    palinfotxt1
  6921.     dc.l    palinfotxt2
  6922.     dc.l    palinfotxt3
  6923.     
  6924. paltypetxt    dc.l    paltypetxt1
  6925.     dc.l    paltypetxt2
  6926.     
  6927. palmethtxt    dc.l    palmthtxt1
  6928.     dc.l    palmthtxt2
  6929.     dc.l    palmthtxt3
  6930.     
  6931. sprmethtxt    dc.l    sprmthtxt1
  6932.     dc.l    sprmthtxt2
  6933.     
  6934. sprctrltxt    dc.l    sprctrltxt1
  6935.     dc.l    sprctrltxt2
  6936.     
  6937. sprdeptxt    dc.l    sprdeptxt1
  6938.     dc.l    sprdeptxt2
  6939.     
  6940. xtrablittxt    dc.l    xtrablttxt1
  6941.     dc.l    xtrablttxt2
  6942.     dc.l    xtrablttxt3
  6943.     
  6944. iffcomptxt    dc.l    iffcomptxt1
  6945.     dc.l    iffcomptxt2
  6946.     
  6947. savemthtxt1    dc.b    'Normal     '
  6948. savemthtxt2    dc.b    'Interleaved'
  6949.  
  6950. palinfotxt1    dc.b    'None  '
  6951. palinfotxt2    dc.b    'After '
  6952. palinfotxt3    dc.b    'Before'
  6953.  
  6954. paltypetxt1    dc.b    '12 Bit'
  6955. paltypetxt2    dc.b    '24 Bit'
  6956.  
  6957. palmthtxt1    dc.b    'Source       '
  6958. palmthtxt2    dc.b    'Copper Source'
  6959. palmthtxt3    dc.b    'Binary       '
  6960.  
  6961. sprmthtxt1    dc.b    'Source'
  6962. sprmthtxt2    dc.b    'Binary'
  6963.  
  6964. sprctrltxt1    dc.b    'Off'
  6965. sprctrltxt2    dc.b    'On '
  6966.  
  6967. sprdeptxt1    dc.b    '4 Colours '
  6968. sprdeptxt2    dc.b    '16 Colours'
  6969.  
  6970. xtrablttxt1    dc.b    'None '
  6971. xtrablttxt2    dc.b    'Left '
  6972. xtrablttxt3    dc.b    'Right'
  6973.  
  6974. iffcomptxt1    dc.b    'None      '
  6975. iffcomptxt2    dc.b    'Byte Run 1'
  6976.  
  6977. filelock    ds.l    1
  6978. olddirlock    ds.l    1
  6979. store1    ds.l    1
  6980. iffend    ds.l    1
  6981. seekpos    ds.l    1
  6982. handle1    ds.l    1
  6983. bodylen    ds.l    1
  6984. buffptr    ds.l    1
  6985. lenstore    ds.l    1
  6986. stdout    ds.l    1
  6987. req1    ds.l    1
  6988. req2    ds.l    1
  6989. message    ds.l    1
  6990. blenpos    ds.l    1
  6991. pladdr    ds.l    1
  6992. plsize    ds.l    1
  6993. oldplsize    ds.l    1
  6994. scrpt1    ds.l    1
  6995. winpt1    ds.l    1
  6996. lswindow    ds.l    1
  6997. prefswin    ds.l    1
  6998. ;tempwinptr    ds.l    1
  6999. ;visinfo    ds.l    1
  7000. ;gadtgad1    ds.l    1
  7001.  
  7002. iffwidth    ds.w    1
  7003. iffheight    ds.w    1
  7004. pagewid    ds.w    1
  7005. pageht    ds.w    1
  7006. iffdepth    ds.w    1
  7007. mask    ds.b    1
  7008. comp    ds.b    1
  7009. height    ds.w    1
  7010. width    ds.w    1
  7011. scrollx    ds.w    1
  7012. scrolly    ds.w    1
  7013. aspects    ds.b    1
  7014.     ds.b    1
  7015. sprwid    ds.l    1
  7016. cdepth    ds.w    1
  7017. mousex    dc.w    $FFFF
  7018. mousey    dc.w    $FFFF
  7019. brtlx    dc.w    $FFFF
  7020. brtly    dc.w    $FFFF
  7021. brbrx    dc.w    $FFFF
  7022. brbry    dc.w    $FFFF
  7023. brtlxoff    dc.w    $FFFF
  7024. brtlyoff    dc.w    $FFFF
  7025. brbrxoff    dc.w    $FFFF
  7026. brbryoff    dc.w    $FFFF
  7027. brushon    ds.b    1
  7028. intopborder    ds.b    1
  7029. bytewid1    ds.w    1
  7030. bytewid2    ds.w    1
  7031. iffcamg    ds.l    1
  7032. lightest    ds.b    1
  7033. darkest    ds.b    1
  7034. lineno    ds.w    1
  7035. maxline    ds.w    1
  7036. lmbpress    ds.b    1
  7037. altpressed    ds.b    1
  7038. ctrlpressed    ds.b    1
  7039. coordtype    ds.b    1
  7040. dtobject    ds.l    1
  7041. dtwidth    ds.l    1
  7042. dtheight    ds.l    1
  7043. bmhdaddr    ds.l    1
  7044. bitmapaddr    ds.l    1
  7045. colortable    ds.l    1
  7046. gads    ds.l    1
  7047. palstore1    dc.l    $AAAAAA00
  7048.     dc.l    $0000FFFF
  7049.     dc.l    $FF6688BB
  7050.     ds.l    63*3
  7051.  
  7052. pal32    ds.l    1
  7053. palstore2    ds.l    257*3
  7054.  
  7055. menupal    dc.w    $aaa
  7056.     dc.w    $000
  7057.     dc.w    $fff
  7058.     dc.w    $68b
  7059.  
  7060. newprefs
  7061. bplmeth    dc.b    0
  7062. palinfo    dc.b    1
  7063. paltype    dc.b    0
  7064. palmeth    dc.b    0
  7065. sprmeth    dc.b    0
  7066. sprctrl    dc.b    1
  7067. sprdepth    dc.b    0
  7068. extrablit    dc.b    0
  7069. iffcomp    dc.b    1
  7070.     ;pad byte
  7071. buffptr1    ds.l    1
  7072. buffptr2    ds.l    1
  7073.  
  7074. loaddir    ds.b    256
  7075. savedir    ds.b    256
  7076. endnewprefs
  7077.  
  7078. oldprefs    ds.b    endnewprefs-newprefs
  7079.  
  7080. pal12src    dc.b    '    DC.W    $'
  7081. pal12mod1    dc.b    '0000',$A
  7082. endpal12
  7083.  
  7084. pal24src    dc.b    '    DC.B    $'
  7085. pal24mod1    dc.b    '00,$'
  7086. pal24mod2    dc.b    '00,$'
  7087. pal24mod3    dc.b    '00',$A,'    DC.W    $106,$0000',$A
  7088. endpal24
  7089.  
  7090. copsrc1    dc.b    '    DC.W    $'
  7091. copmod1    dc.b    '180,$'
  7092. copmod2    dc.b    '0000',$A
  7093. endcop1
  7094.  
  7095. spr16ctrl    dc.b    'spr1'
  7096. sprsaveA    dc.b    '    DC.W    $0000,$0000',$A
  7097. end16save
  7098.  
  7099. spr32ctrl    dc.b    'spr1'
  7100. sprsaveB    dc.b    '    DC.W    $0000,$0000,$0000,$0000',$A
  7101. end32save
  7102.  
  7103. spr64ctrl    dc.b    'spr1'
  7104. sprsaveC    dc.b    '    DC.W    $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000',$A
  7105. end64save
  7106.  
  7107. sprtxt1    dc.b    '    DC.W'
  7108. sprtxt2    dc.b    '    $'
  7109. sprtxt3    dc.b    '0000,$'
  7110. sprtxt4    dc.b    '0000,$'
  7111. sprtxt5    dc.b    '0000,$'
  7112. sprtxt6    dc.b    '0000,$'
  7113. sprtxt7    dc.b    '0000,$'
  7114. sprtxt8    dc.b    '0000,$'
  7115. sprtxt9    dc.b    '0000,$'
  7116. sprtxt10    dc.b    '0000',$A
  7117.  
  7118. nointuitxt    dc.b    'The intuition.library v36 or higher could not be opened,',$a
  7119.     dc.b    'either there is a very serious fault with your Amiga, or you are ',$a
  7120.     dc.b    'simply running out of free memory.',$a,$a
  7121. nointuiend
  7122.  
  7123. nogfxtxt    dc.b    'The graphics.library v36 or higher could not be opened, ',$a
  7124.     dc.b    'either there is a very serious fault with your Amiga, or you are ',$a
  7125.     dc.b    'simply running out of free memory.',$a,$a
  7126. nogfxend
  7127.  
  7128. nogadttxt    dc.b    'The gadtools.library v36 or higher could not be opened, this library',$a
  7129.     dc.b    'is required to run this program',$a,$a
  7130. nogadtend
  7131.     
  7132. noreqttxt    dc.b    'The reqtools.library could not be opened, to run this program you',$a
  7133.     dc.b    'need this library by Nico Francois, copy it to your LIBS: drawer',$a
  7134.     dc.b    'before you attempt to run this program again.',$a,$a
  7135. noreqtend
  7136.  
  7137. noreqatxt    dc.b    'The reqtools.library could not allocate a file requester, the most',$a
  7138.     dc.b    'likely reason for this is lack of free RAM',$a,$a
  7139. noreqaend
  7140.  
  7141. noscreentxt    dc.b    'This program could not open the necessary screen, you must be running',$a
  7142.     dc.b    'out of memory or this computer is not capabable of displaying the required.',$a
  7143.     dc.b    'screen.',$a,$a
  7144. noscreenend
  7145.  
  7146. noks2txt    dc.b    'This program needs Kickstart 2 (v36) or better',$a
  7147.     dc.b    'to function and you do not appear to have it',$a,$a
  7148. noks2end
  7149.  
  7150.     section    buffer,bss
  7151.  
  7152. copybuff    ds.l    1024*2
  7153. copybuffend    ds.b    100    ;extra buffer area 
  7154.             ;in case of compression <0% when picture
  7155.             ;is 65535 pixels wide
  7156.             
  7157. copybuff2    ds.l    1024*2
  7158.     ds.b    100    ;extra buffer area 
  7159.             ;in case of compression <0% when picture
  7160.             ;is 65535 pixels wide
  7161.  
  7162.  
  7163.  
  7164.     SECTION    Chipdata,DATA_C
  7165. mousept    dc.w    %0000000000000000,%0000000000000000
  7166.     dc.w    %0000000100000000,%0000000000000000
  7167.     dc.w    %0000000000000000,%0000000000000000
  7168.     dc.w    %0000000100000000,%0000000000000000
  7169.     dc.w    %0000000000000000,%0000000000000000
  7170.     dc.w    %0000000100000000,%0000000000000000
  7171.     dc.w    %0000000000000000,%0000000000000000
  7172.     dc.w    %0000000000000000,%0000000000000000
  7173.     dc.w    %1010101110101010,%0000000100000000
  7174.     dc.w    %0000000000000000,%0000000000000000
  7175.     dc.w    %0000000000000000,%0000000000000000
  7176.     dc.w    %0000000100000000,%0000000000000000
  7177.     dc.w    %0000000000000000,%0000000000000000
  7178.     dc.w    %0000000100000000,%0000000000000000
  7179.     dc.w    %0000000000000000,%0000000000000000
  7180.     dc.w    %0000000100000000,%0000000000000000
  7181.     dc.w    %0000000000000000,%0000000000000000
  7182.  
  7183. gadgetimage    dc.l    $FFFFFFFF
  7184.     dc.l    $FFFFFFFF
  7185.     dc.l    $FFFFFFFF
  7186.     dc.l    $FFFFFFFF
  7187.     dc.l    $FFFFFFFF
  7188.     dc.l    $FFFFFFFF
  7189.     dc.l    $FFFFFFFF
  7190.     dc.l    $FFFFFFFF
  7191.     dc.l    $FFFFFFFF
  7192.     dc.l    $FFFFFFFF
  7193.     dc.l    $FFFFFFFF
  7194.     dc.l    $FFFFFFFF
  7195.     dc.l    $FFFFFFFF
  7196.     dc.l    $FFFFFFFF
  7197.     dc.l    $FFFFFFFF
  7198.     dc.l    $FFFFFFFF
  7199.     dc.l    $FFFFFFFF
  7200.     dc.l    $FFFFFFFF
  7201.     dc.l    $FFFFFFFF
  7202.     dc.l    $FFFFFF00
  7203.     ds.l    220
  7204.     end
  7205.